Estimate probability of class #5
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)