Feature Engineering в R
Jorge Zazueta
Research Professor. Head of the Modeling Group at the School of Economics, UASLP
Більш повна модель містить багато змінних.
lr_model <- logistic_reg()
lr_recipe <-
recipe(class~ sponsor_code +
contract_value_band +
category_code,
data = grants_train) %>%
step_lencode_glm(sponsor_code,
contract_value_band,
category_code,
outcome = vars(class))
І дає переконливіші результати.
lr_aug %>% class_evaluate(truth = class,
estimate = .pred_class,
.pred_successful)
# A tibble: 2 × 3
.metric .estimator .estimate
<chr> <chr> <dbl>
1 accuracy binary 0.890
2 roc_auc binary 0.951
Можна побудувати графік ознак за важливістю за допомогою пакета vip().
lr_fit %>%
extract_fit_parsnip() %>%
vip(aesthetics =
list(fill = "steelblue"))
Діаграма важливості змінних

Важливість змінних — потужний механізм зворотного зв'язку для уточнення ознак з урахуванням предметної області.

Feature Engineering в R