calibrate_slide: Calibrate predicted probabilities using GAM

View source: R/calibrate_slide.R

calibrate_slideR Documentation

Calibrate predicted probabilities using GAM

Description

Calibrate predicted probabilities using a generalized additive model (GAM).

Usage

calibrate_slide(
  true_labels,
  est_prob,
  n_windows = NULL,
  pos_class_idi = 1,
  k = 9,
  verbose = TRUE
)

Arguments

true_labels

Factor with true class labels

est_prob

Numeric vector with predicted probabilities

n_windows

Integer: Number of calibration windows

pos_class_idi

Integer: Index of the positive class

k

Integer: GAM degrees of freedom

verbose

Logical: If TRUE, printe messages to the console

Details

This is meant for experimentation.

Value

List with mod: fitted GAM model to be used for calibration of new data calibrated_prob: Numeric vector with calibrated probabilities

Author(s)

EDG

Examples

## Not run: 
data(segment_logistic, package = "probably")
# Plot the calibration curve of the original predictions
dplot3_calibration(
  true_labels = segment_logistic$Class,
  est_prob = segment_logistic$.pred_poor,
  n_windows = 10,
  pos_class_idi = 2
)

# Plot the calibration curve of the calibrated predictions
dplot3_calibration(
  true_labels = segment_logistic$Class,
  est_prob = calibrate(segment_logistic$Class, segment_logistic$.pred_poor),
  n_windows = 10,
  pos_class_idi = 2
)

## End(Not run)

egenn/rtemis documentation built on April 24, 2024, 6:58 p.m.