ccf icon indicating copy to clipboard operation
ccf copied to clipboard

Estimate probability of class

Open JamesPetrie opened this issue 2 years ago • 0 comments

Added optional argument to predict() that specifies name of class to compute probabilities for. Computes fraction of training points in each leaf node that belong to that class, and takes average across all trees.

e.g. predict(m1, d_test) # returns vector with majority vote class estimates predict(m1, d_test, probClass = "class1") # returns vector with estimated probability each data point belongs to "class1"

Using pROC library, can plot ROC:

require(pROC) probs = predict(m1, d_test, probClass = "class1") vals = d_test$class == "1" roc1 = roc(vals, probs) ggroc(roc1)

JamesPetrie avatar Mar 13 '22 07:03 JamesPetrie