
Answer-first summary for fast verification
Answer: 12 models
In 3-fold cross-validation, each combination of hyperparameters is trained and evaluated on three separate data folds. With 4 combinations (2 maxDepth options × 2 numTrees options) and 3 folds, the total number of models trained is 4 × 3 = 12. Thus, 12 models are trained during this process.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
Given a parameter grid defined as param_grid = (ParamGridBuilder().addGrid(rf.maxDepth, [2, 5]).addGrid(rf.numTrees, [5, 10]).build()) and using 3-fold cross-validation to find the optimal hyperparameters, how many models will be trained in total?
A
4 models
B
12 models
C
6 models
D
24 models
E
8 models
No comments yet.