calibrate | R Documentation |
Calibrate predicted probabilities using a generalized additive model (GAM).
calibrate(
true.labels,
predicted.prob,
pos.class = NULL,
mod = c("gam", "glm"),
k = 5,
verbose = TRUE
)
true.labels |
Factor with true class labels |
predicted.prob |
Numeric vector with predicted probabilities |
pos.class |
Integer: Index of the positive class |
mod |
Character: Model to use for calibration. Either "gam" or "glm" |
k |
Integer: GAM degrees of freedom |
verbose |
Logical: If TRUE, print messages to the console |
mod: fitted GAM model. Use mod$fitted.values
to get calibrated
input probabilities; use predict(mod, newdata = newdata, type = "response")
to calibrate other estimated probabilities.
EDG
## Not run:
data(segment_logistic, package = "probably")
# Plot the calibration curve of the original predictions
dplot3_calibration(
true.labels = segment_logistic$Class,
predicted.prob = segment_logistic$.pred_poor,
n_windows = 10,
pos.class = 2
)
# Plot the calibration curve of the calibrated predictions
dplot3_calibration(
true.labels = segment_logistic$Class,
predicted.prob = calibrate(
segment_logistic$Class,
segment_logistic$.pred_poor
)$fitted.values,
n_windows = 10,
pos.class = 2
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.