Learn R Programming

fastml (version 0.6.1)

plot.fastml: Plot Methods for fastml Objects

Description

plot.fastml produces visual diagnostics for a trained fastml object.

Usage

# S3 method for fastml
plot(
  x,
  algorithm = "best",
  type = c("all", "bar", "roc", "confusion", "calibration", "residual"),
  ...
)

Arguments

x

A fastml object (output of fastml()).

algorithm

Character vector specifying which algorithm(s) to include when generating certain plots (e.g., ROC curves). Defaults to "best".

type

Character vector indicating which plot(s) to produce. Options are:

"bar"

Bar plot of performance metrics across all models/engines.

"roc"

ROC curve(s) for binary classification models.

"confusion"

Confusion matrix for the best model(s).

"calibration"

Calibration plot for the best model(s).

"residual"

Residual diagnostics for the best model.

"all"

Produce all available plots.

...

Additional arguments (currently unused).

Details

When type = "all", plot.fastml will produce a bar plot of metrics, ROC curves (classification), confusion matrix, calibration plot, and residual diagnostics (regression). If you specify a subset of types, only those will be drawn.

Examples

Run this code
# \donttest{
  ## Create a binary classification dataset from iris
  data(iris)
  iris <- iris[iris$Species != "setosa",]
  iris$Species <- factor(iris$Species)

  ## Fit fastml model on binary classification task
  model <- fastml(data = iris, label = "Species", algorithms = c("rand_forest", "svm_rbf"))

  ## 1. Plot all available diagnostics
  plot(model, type = "all")

  ## 2. Bar plot of performance metrics
  plot(model, type = "bar")

  ## 3. ROC curves (only for classification models)
  plot(model, type = "roc")

  ## 4. Calibration plot (requires 'probably' package)
  plot(model, type = "calibration")

  ## 5. ROC curves for specific algorithm(s) only
  plot(model, type = "roc", algorithm = "rand_forest")

  ## 6. Residual diagnostics (only available for regression tasks)
  model <- fastml(data = mtcars, label = "mpg", algorithms = c("linear_reg", "xgboost"))
  plot(model, type = "residual")
# }

Run the code above in your browser using DataLab