Learn R Programming

MachineShop (version 3.8.0)

plot: Model Performance Plots

Description

Plot measures of model performance and predictor variable importance.

Usage

# S3 method for Calibration
plot(x, type = c("line", "point"), se = FALSE, ...)

# S3 method for ConfusionList plot(x, ...)

# S3 method for ConfusionMatrix plot(x, ...)

# S3 method for LiftCurve plot( x, find = numeric(), diagonal = TRUE, stat = MachineShop::settings("stat.Curve"), ... )

# S3 method for MLModel plot( x, metrics = NULL, stat = MachineShop::settings("stat.TrainingParams"), type = c("boxplot", "density", "errorbar", "line", "violin"), ... )

# S3 method for PartialDependence plot(x, stats = NULL, ...)

# S3 method for Performance plot( x, metrics = NULL, stat = MachineShop::settings("stat.Resample"), type = c("boxplot", "density", "errorbar", "violin"), ... )

# S3 method for PerformanceCurve plot( x, type = c("tradeoffs", "cutoffs"), diagonal = FALSE, stat = MachineShop::settings("stat.Curve"), ... )

# S3 method for Resample plot( x, metrics = NULL, stat = MachineShop::settings("stat.Resample"), type = c("boxplot", "density", "errorbar", "violin"), ... )

# S3 method for TrainingStep plot( x, metrics = NULL, stat = MachineShop::settings("stat.TrainingParams"), type = c("boxplot", "density", "errorbar", "line", "violin"), ... )

# S3 method for VariableImportance plot(x, n = Inf, ...)

Arguments

x

calibration, confusion, lift, trained model fit, partial dependence, performance, performance curve, resample, rfe, or variable importance result.

type

type of plot to construct.

se

logical indicating whether to include standard error bars.

...

arguments passed to other methods.

find

numeric true positive rate at which to display reference lines identifying the corresponding rates of positive predictions.

diagonal

logical indicating whether to include a diagonal reference line.

stat

function or character string naming a function to compute a summary statistic on resampled metrics for trained MLModel line plots and Resample model ordering. The original ordering is preserved if a value of NULL is given. For LiftCurve and PerformanceCurve classes, plots are of resampled metrics aggregated by the statistic if given or of resample-specific metrics if NULL.

metrics

vector of numeric indexes or character names of performance metrics to plot.

stats

vector of numeric indexes or character names of partial dependence summary statistics to plot.

n

number of most important variables to include in the plot.

Examples

Run this code
# \donttest{
## Requires prior installation of suggested package gbm to run

## Factor response example

fo <- Species ~ .
control <- CVControl()

gbm_fit <- fit(fo, data = iris, model = GBMModel, control = control)
plot(varimp(gbm_fit))

gbm_res1 <- resample(fo, iris, GBMModel(n.trees = 25), control)
gbm_res2 <- resample(fo, iris, GBMModel(n.trees = 50), control)
gbm_res3 <- resample(fo, iris, GBMModel(n.trees = 100), control)
plot(gbm_res3)

res <- c(GBM1 = gbm_res1, GBM2 = gbm_res2, GBM3 = gbm_res3)
plot(res)
# }

Run the code above in your browser using DataLab