cal_estimate_logistic {probably} | R Documentation |
Uses a logistic regression model to calibrate probabilities
Description
Uses a logistic regression model to calibrate probabilities
Usage
cal_estimate_logistic(
.data,
truth = NULL,
estimate = dplyr::starts_with(".pred_"),
smooth = TRUE,
parameters = NULL,
...
)
## S3 method for class 'data.frame'
cal_estimate_logistic(
.data,
truth = NULL,
estimate = dplyr::starts_with(".pred_"),
smooth = TRUE,
parameters = NULL,
...,
.by = NULL
)
## S3 method for class 'tune_results'
cal_estimate_logistic(
.data,
truth = NULL,
estimate = dplyr::starts_with(".pred_"),
smooth = TRUE,
parameters = NULL,
...
)
## S3 method for class 'grouped_df'
cal_estimate_logistic(
.data,
truth = NULL,
estimate = NULL,
smooth = TRUE,
parameters = NULL,
...
)
Arguments
.data |
An ungrouped |
truth |
The column identifier for the true class results (that is a factor). This should be an unquoted column name. |
estimate |
A vector of column identifiers, or one of |
smooth |
Applies to the logistic models. It switches between logistic
spline when |
parameters |
(Optional) An optional tibble of tuning parameter values
that can be used to filter the predicted values before processing. Applies
only to |
... |
Additional arguments passed to the models or routines used to calculate the new probabilities. |
.by |
The column identifier for the grouping variable. This should be
a single unquoted column name that selects a qualitative variable for
grouping. Default to |
Details
This function uses existing modeling functions from other packages to create the calibration:
-
stats::glm()
is used whensmooth
is set toFALSE
-
mgcv::gam()
is used whensmooth
is set toTRUE
Multiclass Extension
This method has not been extended to multiclass outcomes. However, the
natural multiclass extension is cal_estimate_multinomial()
.
See Also
https://www.tidymodels.org/learn/models/calibration/,
cal_validate_logistic()
Examples
# It will automatically identify the probability columns
# if passed a model fitted with tidymodels
cal_estimate_logistic(segment_logistic, Class)
# Specify the variable names in a vector of unquoted names
cal_estimate_logistic(segment_logistic, Class, c(.pred_poor, .pred_good))
# dplyr selector functions are also supported
cal_estimate_logistic(segment_logistic, Class, dplyr::starts_with(".pred_"))