View source: R/civic_scorecard.R
| civic_calibrate | R Documentation |
Evaluates whether predicted probabilities are well-calibrated: a model predicting 0.7 should be correct ~70 Returns Brier score and Expected Calibration Error (ECE).
civic_calibrate(object, data, outcome, positive = NULL, n_bins = 10L)
object |
A 'civic_model' (binary classification only). |
data |
A data frame for evaluation. |
outcome |
Character. Outcome column name. |
positive |
Character. Positive class level. |
n_bins |
Integer. Number of probability bins (default '10'). |
An object of class 'civic_calibration' (a list) with: 'bins' (tibble), 'brier_score', 'ece', 'positive', 'outcome', 'model'.
m <- civic_fit(voted ~ age + education, civic_voting)
cal <- civic_calibrate(m, civic_voting, "voted", "yes")
print(cal)
civic_plot_calibration(cal)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.