calibrate_probabilities: This function calibrates model predicted probabilities by...

Description Usage Arguments Examples

Description

This function calibrates model predicted probabilities by aligning them with the actual outcome variable through minimizing the log-loss with Platt scaling. Calibrating to a different event rate is also possible with the 'ct' parameter.

Usage

1
2
calibrate_probabilities(df_pred, target, prediction, top_level = "1",
  ct = 0)

Arguments

df_pred

A data frame containing raw model predictions and the target even

target

Actual outcome variable

prediction

Predicted outcome variable

top_level

Top level of the grouping variable. Defaults to "1"

ct

Central tendency/event rate to which the prediction is to be calibrated. Defaults to 0 if only the log-loss should be optimized

Examples

1
2
3
4
5
6
7
set.seed(42)

outcome <- data_frame(
      default = rbinom(100, 1, 0.5),
      pred = runif(100, 0, 1)
        ) %>%
      calibrate_probabilities(default, pred, "1")

konradsemsch/aider documentation built on May 22, 2019, 2:40 p.m.