시작하기무료로 시작하기

Tune hyperparameters manually

If you already know which hyperparameter values you want to set, you can also manually define hyperparameters as a grid. Go to modelLookup("gbm") or search for gbm in the list of available models in caret and check under Tuning Parameters.

Note: Just as before,bc_train_data and the libraries caret and tictoc have been preloaded.

이 연습은 강의의 일부입니다

Hyperparameter Tuning in R

강의 보기

연습 안내

  • Define the following hyperparameter grid for a Gradient Boosting Model: the number of trees as 200; the tree complexity as 1; the learning rate as 0.1 and the minimum number of training set samples in a node to commence splitting as 10.
  • Apply the grid to the train() function of caret.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Define hyperparameter grid.
hyperparams <- expand.grid(___ = 200, 
                           ___ = 1, 
                           ___ = 0.1, 
                           ___ = 10)

# Apply hyperparameter grid to train().
set.seed(42)
gbm_model <- train(diagnosis ~ ., 
                   data = bc_train_data, 
                   method = "gbm", 
                   trControl = trainControl(method = "repeatedcv", number = 5, repeats = 3),
                   verbose = FALSE,
                   ___ = hyperparams)
코드 편집 및 실행