Skip to content

Conversation

@JamesPetrie
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant