auc | R Documentation |
Calculate the area under the curve of various plots including the receiver operating characteristic and precision-recall curve.
auc(preds, obs, curve = c("roc", "pr"), max_intervals = 1000)
preds |
A vector of predicted probabilities. |
obs |
A vector containing the observed binary outcomes (0 or 1). |
curve |
= c('roc', 'pr') |
max_intervals |
The maximum number of thresholds to evaluate. Default = 1000. |
A named vector with the area under the curve of a specified plot.
# Generate some predictions
predictions <- runif(1000)
# Generate some binary outcomes
observations <- sample(0:1, size = 1000, replace = TRUE)
# Calculate the AUC ROC
auc(predictions, observations, curve = 'roc')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.