Averaged metrics {mldr}R Documentation

Multi-label averaged evaluation metrics

Description

Evaluation metrics based on simple metrics for the confusion matrix, averaged through several criteria.

Usage

accuracy(true_labels, predicted_labels, undefined_value = "diagnose")

precision(true_labels, predicted_labels, undefined_value = "diagnose")

micro_precision(true_labels, predicted_labels, ...)

macro_precision(true_labels, predicted_labels,
  undefined_value = "diagnose")

recall(true_labels, predicted_labels, undefined_value = "diagnose")

micro_recall(true_labels, predicted_labels, ...)

macro_recall(true_labels, predicted_labels, undefined_value = "diagnose")

fmeasure(true_labels, predicted_labels, undefined_value = "diagnose")

micro_fmeasure(true_labels, predicted_labels, ...)

macro_fmeasure(true_labels, predicted_labels,
  undefined_value = "diagnose")

Arguments

true_labels

Matrix of true labels, columns corresponding to labels and rows to instances.

predicted_labels

Matrix of predicted labels, columns corresponding to labels and rows to instances.

undefined_value

The value to be returned when a computation results in an undefined value due to a division by zero. See details.

...

Additional parameters for precision, recall and Fmeasure.

Details

Available metrics in this category

Deciding a value when denominators are zero

Parameter undefined_value: The value to be returned when a computation results in an undefined value due to a division by zero. Can be a single value (e.g. NA, 0), a function with the following signature:

function(tp, fp, tn, fn)

or a string corresponding to one of the predefined strategies. These are:

Value

Atomical numeric vector containing the resulting value in the range [0, 1].

See Also

mldr_evaluate, mldr_to_labels

Other evaluation metrics: Basic metrics, Ranking-based metrics

Examples

true_labels <- matrix(c(
1,1,1,
0,0,0,
1,0,0,
1,1,1,
0,0,0,
1,0,0
), ncol = 3, byrow = TRUE)
predicted_labels <- matrix(c(
1,1,1,
0,0,0,
1,0,0,
1,1,0,
1,0,0,
0,1,0
), ncol = 3, byrow = TRUE)

precision(true_labels, predicted_labels, undefined_value = "diagnose")
macro_recall(true_labels, predicted_labels, undefined_value = 0)
macro_fmeasure(
  true_labels, predicted_labels,
  undefined_value = function(tp, fp, tn, fn) as.numeric(fp == 0 && fn == 0)
)

[Package mldr version 0.4.3 Index]