With reference to the posts: Incorporating terrain data to predict canopy cover using randomForest in R and Random-Forest Classification of 10cm Imagery for species-distribution in R (no point-shapes)

I would like to know how and why would one's model to map canopy vs. non-canopy areas, improve if several predictor variables are added such as:

  • Vegetation indices
  • slope
  • elevation
  • aspect
  • multiple bands

If I do add several predictor variables to the training set, I have to predict the model over a raster stack consisting of the same layers right?

Therefore, can I incorporate bands from Landsat too (after down-scaling to 5.8 m) with my LISS IV bands, as part of the training data and the raster stack on which the model will predict?

1 Answer 1


One of the cool thing about random forest is that they probe at each node a random subset of the variables. The ones providing the split with best entropy (or other criteria) will be kept, while others will be discarded and possibly tested in a subsequent / different node. In very simple words, if a variable does not provide any information about the split (e.g. canopy vs non-canopy) will not be used in the final model. From the other point of view, a variable can become informative after a split on another variable, and, possibly, this variable will be useful at prediction time.

In principle, add all the information you can add (better if you have the prior knowledge that are somehow dependent with the outputs of your problem). Surely Landsat bands and images correlate well with the presence of canopy, so add them.

Personally, I use RF classifiers with thousands of variables. In these situations you only have to make sure that you employ many trees (prevent overfitting, in principle, the most you use the better it is) and that at each note you test indicatively sqrt(#variables) in order to explore properly your feature space. Regarding the fraction of training examples to use in bagging, I never observed significant differences in test accuracy. Training time can be better though.

Regarding your second point yes, all the variables that you use at training time have to be present at test (prediction) time. In the same order, with the same scaling. (Note that the scaling of the variable itself is not important for random forest, but the distribution of training and test data must obviously be the same!)

Regarding literature, the best thing I ever read about RF is this ("THE") RF tutorial. It is mostly biased towards computer vision applications (in particular towards the kinect body part recognition thing they developed) but is a very easy and nice read. After that, you should understand the whole RF thing. For remote sensing application IDK, maybe just browse academic journals. Surely a proper search with right keywords will give nice references.

EDIT: probably you will be interest only in the classification part of the above tutorial, but I suggest to read it entirely, it's very nice.

  • 1
    A few critical considerations on random forests: 1) you can over fit your model by having too much correlation in the ensemble, 2) model selection is important so one is not fitting noise and the tree complexity is minimized, 3) class balance can be a serious issue. I go with a 1/3 rule in proportional class distribution, 4) be mindful of outliers. Whereas this technically not an issue if you have outliers they may not be adequately represented in the bootstrap and thus, could be expressed as a bias in the tails of the distribution. Commented May 29, 2015 at 16:41
  • Indeed, I agree. Correlation between trees is a very bad issue. In principle, if you have relatively few predictors bagging could gain importance so that correlation between trees is reduced. If you have many predictors, randomness in their selection should suffice. Regarding class imbalance, class weights can be introduced to favour small classes in both the entropy/Gini evaluation and at the leaves of the tree. In this respect, this tech report may be interesting. Thank you Jeffrey for the relevant comment!
    – pixelmitch
    Commented May 29, 2015 at 17:33
  • In case you consider to analyze variable importance be advised that this might be impaired by using many likely collinear variables. Random forest calculates variable importance basically by arbitrarily permuting each predictor while keeping all others constant. If a predictor is important, modifying it causes an increase in the model prediction error. When two predictors are highly collinear permuting one of them might not change the model outcome that much. So I would always advise to eliminate collinear predictors. See e.g.: doi.org/10.1111/j.2041-210X.2009.00001.x
    – Niklahrs
    Commented Apr 25, 2022 at 9:09

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.