plot.cm: Plot a confusion matrix

View source: R/confusion_matrix.R

plot.cmR Documentation

Plot a confusion matrix

Description

Plot a confusion matrix

Usage

## S3 method for class 'cm'
plot(x, trans = "log1p", ...)

Arguments

x

a confusion matrix built by confusion_matrix().

trans

transformation function for the color scale.

...

passed to base::plot().

Value

A ggplot object showing a heatmap with true values in lines and predicted values in columns.

Examples

res <- mutate(mtcars, cyl=factor(cyl)) %>%
  resample_split(p=0.5) %>%
  xgb_fit(resp="cyl", expl=c("mpg", "hp", "qsec"), nrounds=20) %>%
  xgb_predict(fns=NULL)
plot(confusion_matrix(res$pred, res$cyl))

jiho/joml documentation built on Dec. 6, 2023, 5:50 a.m.