Get cutoff values for group predictions

get_cutoffs(x)

Arguments

x

Data frame from predict.model_list where outcome_groups or risk_groups was specified

Value

A message is printed about the thresholds. If outcome_groups were defined the return value is a single numeric value, the threshold used to separate predicted probabilities into outcome groups. If risk_groups were defined the return value is a data frame with one column giving the group names and another column giving the minimum predicted probability for an observation to be in that group.

Examples

machine_learn(pima_diabetes[1:20, ], patient_id, outcome = diabetes, models = "xgb", tune = FALSE) %>% predict(risk_groups = 5) %>% get_cutoffs()
#> Training new data prep recipe...
#> Variable(s) ignored in prep_data won't be used to tune models: patient_id
#> #> diabetes looks categorical, so training classification algorithms.
#> #> After data processing, models are being trained on 12 features with 20 observations. #> Based on n_folds = 5 and hyperparameter settings, the following number of models will be trained: 5 xgb's
#> Training at fixed values: eXtreme Gradient Boosting
#> #> *** Models successfully trained. The model object contains the training data minus ignored ID columns. *** #> *** If there was PHI in training data, normal PHI protocols apply to the model object. ***
#> Risk groups defined by the following thresholds:
#> # A tibble: 5 x 2 #> group minimum_probability #> <chr> <dbl> #> 1 risk_group1 0.908 #> 2 risk_group2 0.797 #> 3 risk_group3 0.607 #> 4 risk_group4 0.521 #> 5 risk_group5 0