healthcareai (version 2.3.0)

plot.thresholds_df: Plot threshold performance metrics

Description

Plot threshold performance metrics

Usage

# 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

get_thresholds

Examples

Run this code
# NOT RUN {
m <- machine_learn(pima_diabetes[1:100, ], patient_id, outcome = diabetes,
                   models = "xgb", tune = FALSE, n_folds = 3)

get_thresholds(m) %>%
  plot()

get_thresholds(m, optimize = "cost", measures = c("acc", "cost"), cost_fn = 3) %>%
  plot(point_size = .5, ncol = 1)
# }

Run the code above in your browser using DataCamp Workspace