Plot threshold performance metrics

# S3 method for thresholds_df
plot(
  x,
  title = NULL,
  caption = NULL,
  font_size = 11,
  line_size = 0.5,
  point_size = NA,
  ncol = 2,
  print = TRUE,
  ...
)

Arguments

x

A threshold_df object from get_thresholds or a data frame with columns "threshold" and other columns to be plotted against thresholds. If optimize was provided to get_thresholds a line is drawn in each facet corresponding to the optimal threshold.

title

Plot title. Default NULL produces no title

caption

Plot caption. Default NULL produces no caption unless get_thresholds(optimize) was provided, in which case information about the threshold and performance are provided in the caption.

font_size

Relative size of all fonts in plot, default = 11

line_size

Width of lines, default = 0.5

point_size

Point size. Default is NA which suppresses points. Set to a number to see where threholds are.

ncol

Number of columns of facets.

print

Print the plot? Default = TRUE

...

Unused

Value

A ggplot object, invisibly.

See also

Examples

m <- machine_learn(pima_diabetes[1:100, ], patient_id, outcome = diabetes, models = "xgb", tune = FALSE, n_folds = 3)
#> Training new data prep recipe...
#> Variable(s) ignored in prep_data won't be used to tune models: patient_id
#> #> diabetes looks categorical, so training classification algorithms.
#> #> After data processing, models are being trained on 12 features with 100 observations. #> Based on n_folds = 3 and hyperparameter settings, the following number of models will be trained: 3 xgb's
#> Training at fixed values: eXtreme Gradient Boosting
#> #> *** Models successfully trained. The model object contains the training data minus ignored ID columns. *** #> *** If there was PHI in training data, normal PHI protocols apply to the model object. ***
get_thresholds(m, optimize = "cost", measures = c("acc", "cost"), cost_fn = 3) %>% plot(point_size = .5, ncol = 1)