НачатьНачать бесплатно

The actual tuning

The best hyperparameters make the best model for your data. Once you decided on a tuning grid, you need to train and evaluate models on every grid point to see which grid point gives the best model performance.

This can take some time, given that using k-fold cross-validation, an ensemble size of n trees, and a tuning grid of t combinations makes k * n * t models to be trained in total.

It's your turn to perform the actual tuning! Pre-loaded are customers_train and the results of the last exercise, boost_spec and tunegrid_boost:

# A tibble: 27 x 3
   tree_depth    learn_rate  sample_size
        <int>         <dbl>        <dbl>
 1          1  0.0000000001         0.1 
 2          8  0.0000000001         0.1 
 3         15  0.0000000001         0.1 
 4          1  0.00000316           0.1 
 ...

Это упражнение является частью курса

Machine Learning with Tree-Based Models in R

Посмотреть курс

Инструкции к упражнению

  • Create six folds of the training data using vfold_cv() and save them as folds.
  • Use tune_grid() to tune boost_spec using your folds, your tuning grid, and the roc_auc metric. Save the results as tune_results.
  • Plot the results to visualize the result of the tuning process.

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

# Create CV folds of training data
folds <- ___

# Tune along the grid
tune_results <- ___(___,
                    still_customer ~ .,
                    resamples = ___,
                    grid = ___,
                    metrics = metric_set(___))

# Plot the results
___(___)
Редактировать и запускать код