autoplot.mirvie_learning_curve_cv: Produce a learning curve plot from a mirvie_learning_curve...

Description Usage Arguments Value Examples

Description

This is a method for ggplot2::autoplot().

Usage

1
2
## S3 method for class 'mirvie_learning_curve_cv'
autoplot(object, metric = NULL, smooth = FALSE, meansd = FALSE, ...)

Arguments

object

A mirvie_learning_curve_cv object (i.e. the output of a call to learn_curve_cv()).

metric

A string. The metric used to evaluate the performance.

smooth

A flag. Use a loess smoothed line instead of joining the dots?

meansd

A flag. If there are multiple repeats, rather than plotting all of them, plot means with standard deviation error bars?

...

Arguments passed to ggplot2::autoplot(). Safe to ignore.

Value

A ggplot2::ggplot().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data("BostonHousing", package = "mlbench")
bh <- dplyr::select_if(BostonHousing, is.numeric)
mod <- parsnip::linear_reg(penalty = 0, mixture = 0) %>%
  parsnip::set_engine("lm")
wf <- workflows::workflow() %>%
  workflows::add_formula(medv ~ .) %>%
  workflows::add_model(mod)
metric_calculator <- ~ yardstick::mae(., medv, .pred)$.estimate
lccv <- suppressWarnings(
  learn_curve_cv(bh, wf, 2:9, 8, metric_calculator, n_cores = 4)
)
autoplot(lccv, metric = "mae")
autoplot(lccv, metric = "mae", smooth = TRUE)
autoplot(lccv, metric = "mae", meansd = TRUE)
autoplot(lccv, metric = "mae", smooth = TRUE, meansd = TRUE)

mirvie/mirmodels documentation built on Jan. 14, 2022, 11:12 a.m.