metricCurve: metricCurve

Description Usage Arguments Value Examples

View source: R/metrics.R

Description

Creates a Metric Curve dataset, that can be used to create a metric plot, like a ROC plot or a Precision-recall plot, and calculate AUC. ROC is a special, widely used case of the MC.

Usage

1
metricCurve(p, actual, x, y, res = NULL)

Arguments

p

Vector of predicted probabilities

actual

Vector of actual scores

x

A function operating on the 2x2 confusion matrix, yielding a score. Common functions are precision, recall, fallout and accuracy.

y

A function operating on the 2x2 confusion matrix, yielding a score. Common functions are precision, recall, fallout and accuracy.

res

Specification of the threshold resolution of the curve. Either a single number, a vector of numbers, or NULL. If a single number, it will be used as an interval to create thresholds between 0 and 1. If a vector, it will be used as the vector of thresholds. If NULL, thresholds will be based on the unique values of p.

Value

A data-frame of metric scores, that can be used to create an interesting plot, or to calculate the AUC.

Examples

1
2
3
predicted <- sample(seq(0,1,0.01),replace = TRUE, size = 150)
actual <- sample(c(1,0),replace = TRUE, size = 150)
metricCurve(predicted, actual, precision, recall)

Peder2911/evallib documentation built on Dec. 18, 2019, 2:41 a.m.