confusion: Confusion matrix

View source: R/evalbin.R

confusionR Documentation

Confusion matrix

Description

Confusion matrix

Usage

confusion(
  dataset,
  pred,
  rvar,
  lev = "",
  cost = 1,
  margin = 2,
  scale = 1,
  train = "All",
  data_filter = "",
  arr = "",
  rows = NULL,
  envir = parent.frame(),
  ...
)

Arguments

dataset

Dataset

pred

Predictions or predictors

rvar

Response variable

lev

The level in the response variable defined as success

cost

Cost for each connection (e.g., email or mailing)

margin

Margin on each customer purchase

scale

Scaling factor to apply to calculations

train

Use data from training ("Training"), test ("Test"), both ("Both"), or all data ("All") to evaluate model evalbin

data_filter

Expression entered in, e.g., Data > View to filter the dataset in Radiant. The expression should be a string (e.g., "price > 10000")

arr

Expression to arrange (sort) the data on (e.g., "color, desc(price)")

rows

Rows to select from the specified dataset

envir

Environment to extract data from

...

further arguments passed to or from other methods

Details

Confusion matrix and additional metrics to evaluate binary classification models. See https://radiant-rstats.github.io/docs/model/evalbin.html for an example in Radiant

Value

A list of results

See Also

summary.confusion to summarize results

plot.confusion to plot results

Examples

data.frame(buy = dvd$buy, pred1 = runif(20000), pred2 = ifelse(dvd$buy == "yes", 1, 0)) %>%
  confusion(c("pred1", "pred2"), "buy") %>%
  str()

radiant.model documentation built on Oct. 16, 2023, 9:06 a.m.