Databricks Machine Learning Associate Question 591
Single answerA data scientist is using a grid-search approach combined with 5-fold cross-validation to tune the hyperparameters of a machine learning model. The grid-search includes 3 values for the learning rate, 4 values for the max depth, and 2 values for the number of estimators. How many total models will be trained during this process?
- A
30
- B
60
- C
120
- D
240
Show answer and explanation
Correct answer: B
Explanation
Grid-search evaluates multiple combinations of hyperparameters, and when combined with cross-validation, each combination is trained and validated across all folds. In this case, the grid-search includes 3 x 4 x 2 = 24 hyperparameter combinations. With 5-fold cross-validation, this results in training 24 x 5 = 120 models in total.
- A. Incorrect.
Incorrect: This assumes only one fold is used for cross-validation, which is not the case here since 5-fold cross-validation is applied.
- B. Correct.
Correct: The total number of models trained is calculated as the product of the number of hyperparameter combinations and the number of cross-validation folds. There are 3 x 4 x 2 = 24 hyperparameter combinations, and with 5-fold cross-validation, this results in 24 x 5 = 120 models being trained.
- C. Incorrect.
Incorrect: This assumes an incorrect calculation by overestimating the number of models trained or using an incorrect multiplier for the folds.
- D. Incorrect.
Incorrect: This assumes an even higher number of models trained, likely due to a misunderstanding of the grid-search and cross-validation process.