I am trying to classify satellite based images by creating a region of interest and then classifying according to it.

I am using a Jupyter notebook using python to do that.

I used a Random forest classifier and got a nice model and result, but the problem is that the image is "over classified" meaning that all the pixels et value and force to be classified.

I would like to define level of similarity that a pixel has to have in order to be classified, otherwise, it will not get any class.

For example, the black suppose to be asphalt:

enter image description here

However, in the RGB, you can see it's not asphalt:

enter image description here

Is there any way to define in random forest or any other algorithm "level os similarity"? (For example something similar to n-D angle to match pixels to reference like ised in SAM, but under random forest, or another algorithm that allows define that)

SAM- https://www.harrisgeospatial.com/docs/SpectralAngleMapper.html

My end goal: to get "unclassified" values based on similarity level to the calibration data


1 Answer 1


It seems you can use RandomForest to get probabilities of being in both class by using predict_proba(X).

You could just get thoses probs, get the higher one (which is currently the class assigned to your data), and manually set a threshold, for example setting that if the most probable class is at less than 75%, then you manually classifies it as "Unknown"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.