confusion: Confusion Matrix

Description Usage Arguments Value See Also Examples

View source: R/confusion.R

Description

Calculate confusion matrices of predicted and observed responses.

Usage

1
2
3
4
5
6
7
8
9
confusion(
  x,
  y = NULL,
  cutoff = MachineShop::settings("cutoff"),
  na.rm = TRUE,
  ...
)

ConfusionMatrix(data = NA, ordered = FALSE)

Arguments

x

factor of observed responses or resample result containing observed and predicted responses.

y

predicted responses if not contained in x.

cutoff

numeric (0, 1) threshold above which binary factor probabilities are classified as events and below which survival probabilities are classified. If NULL, then binary responses are summed directly over predicted class probabilities, whereas a default cutoff of 0.5 is used for survival probabilities. Class probability summations and survival will appear as decimal numbers that can be interpreted as expected counts.

na.rm

logical indicating whether to remove observed or predicted responses that are NA when calculating metrics.

...

arguments passed to other methods.

data

square matrix, or object that can be converted to one, of cross-classified predicted and observed values in the rows and columns, respectively.

ordered

logical indicating whether the confusion matrix row and columns should be regarded as ordered.

Value

The return value is a ConfusionMatrix class object that inherits from table if x and y responses are specified or a ConfusionList object that inherits from list if x is a Resamples object.

See Also

c, plot, summary

Examples

1
2
3
4
5
## Requires prior installation of suggested package gbm to run

res <- resample(Species ~ ., data = iris, model = GBMModel)
(conf <- confusion(res))
plot(conf)

MachineShop documentation built on June 18, 2021, 9:06 a.m.