Plot the calibration curves of compare_calibration_curves()
Source:R/calibration_curves.R
plot_calibration_curves.RdObserved precision by score bin (points, sized by the number of clips) and the fitted curves, by group, with the target as a dashed line. The curves should pass through the points near the target.
Arguments
- x
A data frame (tibble), the output of
compare_calibration_curves().- validation
NULLor a data frame (or tibble) of the reviewed clips, one row per clip, to show bins over the whole score range. Without it, only the high bins oftop_errorare shown.- bin_width
Numeric scalar in (0, 1), width of the bins of the observed precision, over the whole score range.
Examples
ex <- system.file("extdata", "example", package = "sheepdog")
validation <- read_validation_tables(list.files(file.path(ex, "validation"),
full.names = TRUE))
cmp <- compare_calibration_curves(validation, curves = "logistic",
k_folds = 3)
# Observed precision over the whole score range
if (requireNamespace("ggplot2", quietly = TRUE)) {
plot_calibration_curves(cmp, validation = validation)
}