Random Forest NAN at Confidence values below 0.5

I am very pleased to see new classification algorithms being implemented in the new SNAP Version. Very Nice! However, the random forest classifier seems to be implemented to assign NoData as soon as the confidence is below 0,5. This cannot be found in the documentation and it seems it cannot be switched off. Or did I not find this part in the docu and the possibility to change this behaviour? It would be necessary for my application to classify the Pixels even if the confidence is low. From the algorithm side this is not necessary, the final class in RF is determined by looking which class is predicted by most trees.

Thank you, Keep up the great work,

I also experienced this behaviour for RF and the KD Tree Classifier.
I didn’t find any way to set this threshold - have you found a solution?

The user graph of the classifier has no such option:

Thanks, yes I’ll add a parameter for this. All the data is actually still there. It’s only the valid pixel expression in the band that uses this threshold. Right click on the class band and go to properties. Here you can change the threshold or take it out completely.

thanks for the response.
I tried this but the result at these pixels is -1 (NoData). Is this caused by the RF/KD algorithm or the module?

@dreckbolle: This solution is not SNAP related, but I achieved great results with the ENMaP-Toolbox.
You need the IDL virtual machine (installation of IDL, needs no license) for it and can load the DIMAP rasters directly into the program.
You can also import Shapefiles as training vectors so no conversion of your data is needed.

Also its computing time is impressive (raster with 5000*8000 and 50 bands takes about 3 minutes). Is quite simple to use and allows for changes in the RF parametrization.

  1. import the rasters
  2. stack the rasters
  3. import the vectors as classified raster
  4. train the RF model
  5. apply the RF model

Wow, thank you both so much!
@lveci: works. Thx! I changed the Confidence Value to 0 and all pixels were classified.

@ABraun: looks and sound nice, I will have a look into the ENMap toolbox, seems like they support multicore processing? I usually use an R-Script for the RF classification, which is slow, and does not support multiple cores on windows - only in Linux and MacOSX. I think the biggest advantage of having state of the art classifiers in SNAP, besides convenience, is that we do not necessarily have to do the ground projection of multiple rasters before classification.

Dear ABraun… It is interesting using EnMAP as your work. What data was used as an input in EnMAP for your case? Could I use GRD Sentinel-1 data after terrain correction in SNAP dim file? Actually, I would like to use data from SNAP Products in ArcGIS, but I don’t know how to do?

if your data is processed in the *.dim format (standard for SNAP) you can directly use the *.img-files in the *.data folders in EnMAP.

You should theoretically also be able to use the img files in ArcMap. Maybe you will have to define the projection again as it probably not read correctly from the *.dim file.

1 Like

OK thanks so much for your help. I will try to plot SNAP product in ArcMAP as your suggestion, so it will be a nice map with coordinates and colorbar.

Dear ABraun, thanks so much. It works.

Could you please help me to understand how the calculation of the Random Forest confidence map that is implemented in SANP?
I know what it is used for but I can’t find how it is calculated.
Thank you

maybe this clarifies it to you:

1 Like

Though I changed the Confidence Value to 0 it doesn’t worked for me. What might be the reason ?


What exactly doesn’t work, looks like you have 2 classes? Maybe you can give some more information about your classification and the input data? Cheers.

Yes . I have two classes. One is water and the other one is non-water. Though I changed the confidence value to 0 from 0.5 and unchecked the “No-data value used” in the LabelledClasses - Properties. Still Black colour marks appears on the classified image as shown in the image(uploaded in the previous post).

what value is entered in the dark areas? You can check in with the Pixel Info tab.

Nan Value

With the 2 classes I am also facing the same issue.

what happens when you lower the confidence value?

Using the Band maths:
IF Confidence <= 0.5 THEN 0 ELSE LabeledClasses
No change in the image/ pixels values