variable's name gets modified in varImp
spono opened this issue · 0 comments
spono commented
I'm working on a binary classification using randomForest
on a SpatRaster
.
The training data includes two binary (0,1) factor variables, one of which is the target of the classification.
Once I train the RF model (cls.model
) and check the variable importance, I get that the variable's name is modified from comp_cat_cl
to comp_cat_cl1
:
> cls.model = train( mg_cl ~ ., method="rf" , data=training_set
, trControl = trainControl(method="repeatedcv", number=10, repeats=3, search="random") )
> varImp(cls.model)$importance
Overall
comp_cat_cl1 100.00000 <------ "1" gets added to the variable's name
pground 29.53763
pzabove2 29.22343
This weird behaviour disappears if I run directly fom randomForest
, I get:
> cls.model2 = randomForest::randomForest( mgnt_cl ~ ., method="rf" , data=training_set)
> varImp(cls.model2)
Overall
comp_cat_cl 7.717525
pground 5.044546
pzabove2 5.306768
here the data
test_data.txt