View source: R/machinelearning.R
| multiClassSummary | R Documentation |
Compute overall and class-averaged performance metrics for multiclass classification models, including ROC AUC and log-loss when class probabilities are available.
multiClassSummary(data, lev = NULL, model = NULL)
data |
A data frame containing at least the columns 'pred' and 'obs', plus one probability column per class when ROC or log-loss are needed. |
lev |
An optional character vector with the class levels. |
model |
An optional fitted model object passed by 'caret'. |
A named numeric vector with overall and class-averaged classification statistics.
data <- data.frame(
pred = factor(c("A", "B", "A", "B"), levels = c("A", "B")),
obs = factor(c("A", "B", "B", "B"), levels = c("A", "B")),
A = c(0.8, 0.2, 0.7, 0.3),
B = c(0.2, 0.8, 0.3, 0.7)
)
multiClassSummary(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.