View source: R/draw_calibration.R
draw_calibration | R Documentation |
Draw calibration plot
draw_calibration(
true_labels,
predicted_prob,
n_bins = 10L,
bin_method = c("quantile", "equidistant"),
binclasspos = 2L,
main = NULL,
subtitle = NULL,
xlab = "Mean predicted probability",
ylab = "Empirical risk",
show_marginal_x = TRUE,
marginal_x_y = -0.02,
marginal_col = NULL,
marginal_size = 10,
mode = "markers+lines",
show_brier = TRUE,
theme = choose_theme(),
filename = NULL,
...
)
true_labels |
Factor or list of factors with true class labels |
predicted_prob |
Numeric vector or list of numeric vectors with predicted probabilities |
n_bins |
Integer: Number of windows to split the data into |
bin_method |
Character: "quantile" or "equidistant": Method to bin the estimated probabilities. |
binclasspos |
Integer: Index of the positive class. The convention used in the package is the second level is the positive class. |
main |
Character: Main title |
subtitle |
Character: Subtitle, placed bottom right of plot |
xlab |
Character: x-axis label |
ylab |
Character: y-axis label |
show_marginal_x |
Logical: Add marginal plot of distribution of estimated probabilities |
marginal_x_y |
Numeric: y position of marginal plot |
marginal_col |
Character: Color of marginal plot |
marginal_size |
Numeric: Size of marginal plot |
mode |
Character: "lines", "markers", "lines+markers": How to plot. |
show_brier |
Logical: If TRUE, add Brier scores to trace names. |
theme |
Theme object. |
filename |
Character: Path to save output. |
... |
Additional arguments passed to draw_scatter |
plotly
object.
EDG
## Not run:
data(segment_logistic, package = "probably")
# Plot the calibration curve of the original predictions
draw_calibration(
true_labels = segment_logistic$Class,
predicted_prob = segment_logistic$.pred_poor,
n_bins = 10L,
binclasspos = 2L
)
# Plot the calibration curve of the calibrated predictions
draw_calibration(
true_labels = segment_logistic$Class,
predicted_prob = calibrate(
segment_logistic$Class,
segment_logistic$.pred_poor
)$fitted.values,
n_bins = 10L,
binclasspos = 2L
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.