How do I change the cutoff parameter in R randomForest?

The documentation states that cutoff is a vector of length equal to the number of classes. The "win" class to observe is the one with the maximum vote-to-cut ratio. The default is 1 / k, where k is the number of classes (i.e., the majority of votes wins).

I want to implement a cutoff of the probabilities of 0.6 or 0.7, not the default 0.5.

RFfit <- randomForest(Y ~ x1 + x2 + x3 + x4 + x5, data=mydata, mytry=2, ntrees=500,
  cutoff = x)

      

I have tried various values ​​for x. 0.6, 6, 12, 1.2 ... doesn't seem to work. I also added a "cutoff" column to my data, where all values ​​are = 0.6, and tried to call that in code, but that didn't work either.

How to use the cutoff argument correctly?

+3


source to share


1 answer


Correct format

cutoff=c(k,1-k) 

      

Where k can be any value between 0 and 1. For example,



cutoff=(0.7,1-0.7)

      

or

cutoff=(0.5,1-0.5)

      

+6


source







All Articles