[GRASS-user] v.class.mlR Error

Moritz Lennert mlennert at club.worldonline.be
Wed Jun 20 04:48:11 PDT 2018


On 20/06/18 13:18, Moritz Lennert wrote:
> Actually I noticed that your error message concerned the qbwwv voting
> algorithm which wasn't in the command line you provided. I was just able
> to reproduce your error using that same voting scheme. I'll have to dig
> into this a bit deeper to see where the error comes from.

I think I found the issue: your training data is insufficient.

Here is the number of training segments for each class:

  1  2  3  4  5  6  7  8  9 10 11 12 13 15 16 18 19 20
  2  2  1  2  7 12  1  1  3  3  2  2  4  2  1  1  2  2

As you can see most classes have only 1-2 segments. The random forest 
algorithm's crossvalidation works by randomly selecting subsets of 
training data for each run. This means that using your training data set 
it will very often have subsets with some classes not represented at 
all, leading to warnings such as this:

50: model fit failed for Fold4.Rep02: mtry=60 Error in 
randomForest.default(x, y, mtry = param$mtry, ...) :
   Can't have empty classes in y.

This means that often the random forest algorithm cannot determine 
accuracy measures through cross-validation. These accuracy measures are 
used as weights in the weighted voting schemes.

You could still use v.class.mlR either by not using a tree based 
approach such as random forest, or by not using a weighted vote, but 
just a simple majority vote (the default). But I would not recommend it 
in light of your limited training data. In general rule of thumb you 
should have at least 30 training segments per class, but often you might 
even need a bit more. Another solution would be to be less ambitious in 
terms of number of classes. 20 is a lot. Often classifications target 
5-10 classes.

Moritz




More information about the grass-user mailing list