class_error: Classification Error

View source: R/class_error.R

class_errorR Documentation

Classification Error

Description

Calculates Classification Metrics

Usage

class_error(
  true,
  estimated,
  estimated.prob = NULL,
  calc.auc = TRUE,
  calc.brier = TRUE,
  auc.method = c("pROC", "ROCR", "auc_pairs"),
  trace = 0
)

Arguments

true

Factor: True labels

estimated

Factor: Estimated values

estimated.prob

Numeric vector: Estimated probabilities

calc.auc

Logical: If TRUE, calculate AUC. May be slow in very large datasets.

calc.brier

Logical: If TRUE, calculate Brier Score

auc.method

Character: "pROC", "ROCR", "auc_pairs": Method to use, passed to auc.

trace

Integer: If > 0, print diagnostic messages. Default = 0

Details

Note that auc.method = "pROC" is the only one that will output an AUC even if one or more estimated probabilities are NA.

Value

S3 object of type "class_error"

Author(s)

E.D. Gennatas

Examples

## Not run: 
true <- factor(c("a", "a", "a", "b", "b", "b", "b", "b", "b", "b"))
estimated <- factor(c("a", "a", "b", "b", "a", "a", "b", "b", "a", "a"))
estimated.prob <- c(0.7, 0.55, 0.45, 0.25, 0.6, 0.7, 0.2, .37, .57, .61)

class_error(true, estimated, estimated.prob, auc.method = "pROC")
class_error(true, estimated, estimated.prob, auc.method = "ROCR")
class_error(true, estimated, estimated.prob, auc.method = "auc_pairs")

## End(Not run)

egenn/rtemis documentation built on Dec. 17, 2024, 6:16 p.m.