Get predictive indicator for partial models given a model
Source:R/model-diagnostics.R
model_partials.Rd
Get predictive indicator for partial models given a model
Examples
data("credit_woe")
m <- glm(bad ~ age_woe + flag_res_phone_woe + months_in_the_job_woe +
payment_day_woe + sex_woe + profession_code_woe + marital_status_woe,
family = binomial, data = head(credit_woe, 10000)
)
model_partials(m)
#> ℹ Fitting and evaluating model with 1 variables: age_woe
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 2 variables: age_woe, flag_res_phone_woe
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 3 variables: age_woe, flag_res_phone_woe, m...
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 4 variables: age_woe, flag_res_phone_woe, m...
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 5 variables: age_woe, flag_res_phone_woe, m...
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 6 variables: age_woe, flag_res_phone_woe, m...
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 7 variables: age_woe, flag_res_phone_woe, m...
#> ℹ Creating woe binning ...
#> # A tibble: 7 × 5
#> variable ks auc iv gini
#> <fct> <dbl> <dbl> <dbl> <dbl>
#> 1 age_woe 0.204 0.624 0.190 0.248
#> 2 flag_res_phone_woe 0.207 0.641 0.248 0.283
#> 3 months_in_the_job_woe 0.223 0.650 0.276 0.301
#> 4 payment_day_woe 0.238 0.656 0.304 0.312
#> 5 sex_woe 0.247 0.659 0.309 0.319
#> 6 profession_code_woe 0.244 0.661 0.329 0.321
#> 7 marital_status_woe 0.244 0.662 0.335 0.324
model_partials(m, newdata = tail(credit_woe, 10000))
#> ℹ Fitting and evaluating model with 1 variables: age_woe
#> ℹ Creating woe binning ...
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 2 variables: age_woe, flag_res_phone_woe
#> ℹ Creating woe binning ...
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 3 variables: age_woe, flag_res_phone_woe, m...
#> ℹ Creating woe binning ...
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 4 variables: age_woe, flag_res_phone_woe, m...
#> ℹ Creating woe binning ...
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 5 variables: age_woe, flag_res_phone_woe, m...
#> ℹ Creating woe binning ...
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 6 variables: age_woe, flag_res_phone_woe, m...
#> ℹ Creating woe binning ...
#> ℹ Creating woe binning ...
#> ℹ Fitting and evaluating model with 7 variables: age_woe, flag_res_phone_woe, m...
#> ℹ Creating woe binning ...
#> ℹ Creating woe binning ...
#> # A tibble: 14 × 6
#> variable sample ks auc iv gini
#> <fct> <fct> <dbl> <dbl> <dbl> <dbl>
#> 1 age_woe train 0.204 0.624 0.190 0.248
#> 2 age_woe test 0.194 0.624 0.213 0.249
#> 3 flag_res_phone_woe train 0.207 0.641 0.248 0.283
#> 4 flag_res_phone_woe test 0.208 0.645 0.262 0.289
#> 5 months_in_the_job_woe train 0.223 0.650 0.276 0.301
#> 6 months_in_the_job_woe test 0.225 0.654 0.312 0.307
#> 7 payment_day_woe train 0.238 0.656 0.304 0.312
#> 8 payment_day_woe test 0.234 0.658 0.335 0.317
#> 9 sex_woe train 0.247 0.659 0.309 0.319
#> 10 sex_woe test 0.241 0.665 0.344 0.329
#> 11 profession_code_woe train 0.244 0.661 0.329 0.321
#> 12 profession_code_woe test 0.249 0.669 0.365 0.337
#> 13 marital_status_woe train 0.244 0.662 0.335 0.324
#> 14 marital_status_woe test 0.251 0.671 0.385 0.341