so, I've found the misclassified instances in my Random forest model have lower values in some predictors, how can I adjust the model so that the threshold is more sensitive to these predictors?

     fit1 <- cforest((b == 'three')~   affect+ certain+ negemo+ future+swear+sad
                +negate+ppron+sexual+death + filler+leisure + conj+ funct + i
                +future + past + bio + body+cause + cogmech + death +
                discrep + future +incl + motion + quant + sad + tentat + excl+insight +percept +posemo
                +ppron +quant + relativ + space + article
                , data = trainset1, 
                controls=cforest_unbiased(ntree=1000, mtry= 1))

table1 <- table(predict(fit1, OOB=TRUE, type = 'response') > 0.5, trainset1$b == 'three') 


FALSE   213  200
TRUE    821 1121

As the result has shown, 821 of other classes are misclassified as "three", suppose I want to adjust the model so that it is more sensitive to these variables: negemo, posemo, swear. What should I do? Thank you

  • 1
    $\begingroup$ What is the reason you want to give more weights to those variables? $\endgroup$
    – Metariat
    Sep 2, 2015 at 8:11

1 Answer 1


In general let a forest algorithm up-weight/down-weight use of variables. I notice you have set mtry=1. Then, only one random variable is picked in every split. If you expect some variables would be more useful, increase mtry to e.g. a 1/3(default) of total variable number to allow the RF model to use some variables more than others. If a variable is very useful, it will achieve better loss function scores and get picked more often. If mtry is too high tree-decorrelation may suffer, and probably an optimal mtry is less than 2/3 of total variable number.

You can also utilize variable importance to check if some variables are 'trash' and rerun the model without them. Be-aware of mild over-fitting when selecting variables like this.

It is possible to train an ensemble where different sub-models are weighted accordingly to some learned function of feature inputs. But that would probably be too excessive in your case.


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.