Learn R Programming

rtemis (version 1.4.3)

roc_table: ROC Curves of a Classification Model

Description

The ROC curves of a fitted classification model for each sample it stores predicted probabilities for: the data plot_roc() draws, as a table.

Usage

roc_table(
  x,
  sample = NULL,
  variant = "aggregate",
  positive = NULL,
  max_points = NULL
)

Value

data.table with columns sample; resample, for variant = "per_resample"; class; fpr; tpr; auc, constant within a curve; and omitted.

Arguments

x

Classification or ClassificationRes object.

sample

Optional Character {"training", "validation", "test"}: The sample whose curves to return. NULL returns every sample with predicted probabilities.

variant

Character {"aggregate", "per_resample"}: For a resampled model, pooled curves or one curve per resample. An ordinary model has aggregate curves only.

positive

Optional Character: Positive class of a binary model. NULL uses the second level of the outcome.

max_points

Optional Integer [2, Inf): Cap on the number of vertices per curve. NULL keeps every vertex.

Author

EDG

Details

Binary models have one curve, for the positive class; multiclass models have one one-vs-rest curve per class. For a resampled model, variant = "aggregate" pools the predictions of every outer resample into one curve per sample and class, and variant = "per_resample" gives one curve per resample, labeled in the resample column. A resample whose probabilities are missing has an undefined curve, with auc NA. omitted counts the cases whose probability or label is missing.

roc_curve() computes the curve of supplied labels and probabilities.

Examples

Run this code
mod <- train(iris, hyperparameters = setup_CART(), verbosity = 0L)
roc_table(mod)

Run the code above in your browser using DataLab