evaluatePerformance: Calculates several performance statistics

View source: R/SOptim_PerformanceEval.R

evaluatePerformanceR Documentation

Calculates several performance statistics

Description

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).

Usage

evaluatePerformance(obs = NULL, pred = NULL, cm = NULL)

Arguments

obs

Integer vector with observed values (class labels).

pred

Integer vector with predicted values (class labels).

cm

A confusion matrix generated by generateConfusionMatrix function.

Details

Adapted from https://github.com/saidbleik/Evaluation/blob/master/eval.R.

Value

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).

Examples

obs<-sample(c(1:5),100,replace = TRUE)
pred<-sample(c(1:5),100,replace = TRUE)
evaluatePerformance(obs, pred)


joaofgoncalves/SegOptim documentation built on Feb. 5, 2024, 11:10 p.m.