About the predict(type = class) threshold of the machine learning package

I use kernlab and randomforest for classification.
I was wondering when I was comparing the output of (type = prob) with the output of (type = class).

How are the thresholds determined? (>0.5 ? >=0.5 ?)
Does it change depending on the package?
Where should I look for the source code? ( r-source stats::predict ??)

thank you

predict() is a generic that has methods defined in each package; the correct method is chosen depending on the class of the model. Use the class() function to determine it.

For example, if class(obj) == "randomForest", predict(obj) is automatically calling randomForest::predict.randomForest(obj).

For example, for randomForest. For kernLab, there are several predict() methods that are chosen depending on the model, e.g. predict.gausspr(), same for qkr and ksvm.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.