micro_avg | R Documentation |
Calculate the micro-averaged performance of some measure against a binary outcome across a range of classes in a multi-label classification task.
micro_avg(preds, obs, metric = cstat, ...)
preds |
A matrix of predicted probabilities for each class. |
obs |
A matrix containing the observed binary outcomes (0 or 1) for each class. Columns should occur in the same order for 'preds' and 'obs'. |
metric |
A function name for the performance metric of interest. Default is 'cstat'. |
... |
Additional parameters that can be passed to 'metric' as needed. |
The micro-averaged 'metric' as a single numeric value.
# Generate some predictions
predictionsA <- runif(1000)
predictionsB <- runif(1000)
# Generate some binary outcomes
observationsA <- sample(0:1, size = 1000, replace = TRUE)
observationsB <- sample(0:1, size = 1000, replace = TRUE)
# Calculate the C-statistic
micro_avg(matrix(c(predictionsA, predictionsB), ncol = 2),
matrix(c(observationsA, observationsB), ncol = 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.