I run a random forest classification for agricultural land use and other land cover classes (12 classes). My dataset for 2019 consists of a Sentinel 1 and Sentinel 2 monthly time series, statistical phenometrics (e.g. min/ max/ median/ stdDev) and ancillary data as texture metrics and topographic derivates. I included a lot of different indices calculated on the basis of the sentinel 2 optic bands. This resulted in a single image with 294 bands as a big input data cube for the random forest algorithm. In order to decrease computational time I would like to calculate the feature importance of the different bands in that image for each one class against all classification and then only use the most important bands. So far I didn't find a lot in different blogs and platforms.

I found an approach on MyGeoBlog that is unfortunately showing an error that I couldn't resolve. In theory this approach should work with the one class against all other classification approach. Find my adjusted script with the following link (note that its a different dataset with only 216 bands without the sentinel 1 data):


The original script on MyGeoBlog you may access via this link (however it is lacking input data):


In my case GEE shows the usual point feature size exceeding error but also the error: "Error generating chart: Property 'Grass_Mask' of feature '0' is missing." Since for this script you can only calculate probability with 2 classes I transformed my 12 classes of a LULC_Class property to a binary property column that is called grass mask (with only values of 1 for grassland and 2 for all other classes).

I'm happy to hear about your thoughts and experiences with calculating the feature importance in the GEE environment. I could also do it in R but then I have to download my very large dataset.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.