View source: R/SOptim_PerformanceEval.R
evaluatePerformance | R Documentation |
A function used to calculate several performance evaluation metrics, namely: accuracy, Peirce skill score, and Cohen Kappa (as aggregated performance metrics, for all classes) as well as precision, recall and the F1-statistic (for each class).
evaluatePerformance(obs = NULL, pred = NULL, cm = NULL)
obs |
Integer vector with observed values (class labels). |
pred |
Integer vector with predicted values (class labels). |
cm |
A confusion matrix generated by |
Adapted from https://github.com/saidbleik/Evaluation/blob/master/eval.R.
A list object containing:
Numeric matrix. Holds the confusion matrix;
Numeric data frame with several metrics by column:
Class - class names/numbers,
Accuracy - overall accuracy,
PeirceSkillScore - Peirce skill score (Hanssen and Kuipers discriminant or true skill statistic),
Kappa - Cohen Kappa statistic,
Precision - precision (by class)
Recall - recall (by class)
F1 - F1-statistic (by class).
obs<-sample(c(1:5),100,replace = TRUE)
pred<-sample(c(1:5),100,replace = TRUE)
evaluatePerformance(obs, pred)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.