This function computes a multi-response classification metric.
Usage
multiresponse_classification_metric(
true,
pred,
multi = c("weighted", "average", "micro", "macro", "raw", "binary"),
metric,
positive = 1,
weights,
confusion = NULL,
...
)Arguments
- true
a vector (or a matrix) of observed values. If a matrix is provided, a multi-response is assumed
- pred
a vector (or a matrix) of predicted values
- multi
what to do when response has multiple output values
averageerrors of multiple outputs are averaged to get a single value for each observation
microthe score is computed by using the global number of true positives, false negatives and false positives
macroscores of different classes are averaged by unweighted mean to get a single value. Class imbalance is not taken into account
weightedscores of different classes are averaged by weighted mean to get a single value. Weights are number of true instances per class. It takes into account label imbalance
rawreturns a vector containing one score for each class
binaryreturns the score for the class specified by
positive
- metric
character string indicating the score to compute
- positive
integer or character indicating the target class. If
positive = 0(default), global values are computed.- weights
observation weights (not implemented yet)
- confusion
a confusion matrix as returned by
confusion_matrix. Ifconfusionis not provided, a confusion matrix is internally computed by usingtrueandpred
Value
A single score for the selected class if multi = "binary",
a vector containing one score for each class if multi = "raw",
a summary score computed by using the global metrics if multi = "micro" or
averaging the results from different classes if multi = "macro". A summary score
produced by a weighted average of the results from different class is produced if
multi = "weighted"