I am working on a project to detect crops from satellite images by prediction. To do so, I use Random Forest model. I discussed with some people about whether to give sample weights on each tree in the model but still couldn't get a clear understanding.

I have 14 classes consisting of water, surface, vegetation, and crops on an area of my interest. Without even knowing the real distribution of these classes, does it make sense to give sample weights? My task is actually finding these weight. Shouldn't giving them beforehand mislead the results?

I couldn't find enough resources on the web about sample weights in randomforest. If you may give me some intutions, it'd be the best.

Here is a summary of my data:

It is a raster time series data with 15 clean images throughout 6 months (15 dates)

Each image has 4 bands - red, green, blue, NIR

We can generate another band called NDVI as NDVI = (NIR - Red) / (NIR + Red)

We can also calculate GLCM measures which can give us texture information. I calculated 3 GLCM measure - mean, entropy, and contrast. Please beware that GLCM mean is different than mean. You can calculate those for each band

Date variable: 15

Band variable: 5 for each date

GLCM: 3 for each band

Total variable: 15x5x3 = 225

Region of Interest Dimension: 20086 x 19754 pixels (3x3 m resolution)

It means it is quite large data to predict. And my area is x4 of this area. I had to split it to process even on the cloud.

A quick summary of my training data (These are collected by drawing the fields and labeling them), it is only from one part of the image:


  • $\begingroup$ 0. Welcome to the CV community. 1. Can you please give a few more details about what you try to achieve. 2. How big is your dataset and what is the nature of it. $\endgroup$ – usεr11852 Aug 3 '19 at 15:51
  • $\begingroup$ Hi, I tried to give some intuition. My case is quite complex so I didn't want to give more details, but I could add more if it's more appropriate $\endgroup$ – Batuhan Kavlak Aug 3 '19 at 16:31

Stratified random sampling in Random Forests is done when you have an unbalanced data set, that is you have a different number of observations in your categories. If that is the case, then a simple random sampling (done in each tree) to obtain a bootstrap sample is going to be even more unbalanced.

To prevent this, you would use stratified random sampling, which is different from supplying the weight argument, albeit used for the same purpose. If your sampling was done right, then your sample should be representative of the population, and the proportion of cases in each category is the best estimate of the true population parameter.

In short, stratified sampling in RF is done to prevent biasing your trees.


Your Answer

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

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