Function get_performance calculates the best performance measure when prediction object is given.

get_performance(pred, measure)

get_max(pred, FUN)

AUC(pred)

tp(pred)

fp(pred)

fn(pred)

tn(pred)

cutoff(pred)

Se(pred)

Sp(pred)

J(pred)

Bac(pred)

Acc(pred)

Kappa(pred)

Wkappa(pred)

kappa_helper(pred, FUN_)

make_conf_matrix(TP, FN, FP, TN)

Arguments

pred

An object of class prediction from package ROCR.

measure

(string(1))
A string with the name of classification performance measure to use. Currently available options:

  • "bac" - for balanced accuracy (mean of sensitivity and specificity);

  • "kappa" - for Cohens kappa;

  • "wkappa" - for weighted Cohens kappa;

  • "j" - for Youden's index;

  • "auc" - for area under the ROC curve;

  • "acc" - for accuracy (total proportion of correctly identified cases).

FUN

Function to apply (one of Acc, Bac, J, Kappa, Wkappa, etc.)

FUN_

Function to apply (either measure_kappa or measure_wkappa)

TP

Number of true positives.

FN

Number of false negatives.

FP

Number of false positives.

TN

Number of true negatives.

Value

Function get_performance returns a numeric vector with 2 elements:

  • the first element is the highest value of selected performance measure;

  • the second element is either corresponding cut-off value, or NA if the measure is "auc".