BaşlayınÜcretsiz Başlayın

Tune random forest models

Now that you have a working logistic regression model you will prepare a random forest model to compare it with.

Bu egzersiz

Machine Learning in the Tidyverse

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use crossing() to expand the cross-validation data for values of mtry using the values of 2, 4, 8, and 16.
  • Build random forest models for each fold/mtry combination.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

library(ranger)

# Prepare for tuning your cross validation folds by varying mtry
cv_tune <- cv_data %>%
  crossing(mtry = c(___)) 

# Build a cross validation model for each fold & mtry combination
cv_models_rf <- cv_tune %>% 
  mutate(model = map2(___, ___, ~ranger(formula = Attrition~., 
                                           data = .x, mtry = .y,
                                           num.trees = 100, seed = 42)))
Kodu Düzenle ve Çalıştır