A grid has 3 values of maxDepth and 4 values of numTrees, with 5-fold cross-validation. How many models are trained during cross-validation, before the final refit on all data?
- Exam domain
- Model Development31% of the exam
- Difficulty
- Hard
- In this mock
- 16 questions on this domainPractise this domain
Why the exam asks this
Model Development (31% of the exam)
Objective in the exam guide: Identify the number of models being trained in conjunction with a grid-search and cross-validation process
Counting models in grid search with cross-validation is named.
Why B is the answer
60, because 12 combinations are each trained on 5 folds
Combinations multiply: 3 × 4 = 12. Each is trained once per fold: 12 × 5 = 60. Spark's CrossValidator then fits the best combination once more on the full data.
Remember: Combinations × folds.
How it works
Grid search cost scales with combinations times folds.
In detail
- Combinations multiply.
- Times the folds.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. 20, because the folds and parameters add togetherWrong
Folds multiply, they do not add.
B. 60, because 12 combinations are each trained on 5 foldsRight
Combinations × folds.
C. 7, the sum of the grid sizesWrong
Grid sizes multiply.
D. 12, because each combination is trained onceWrongMost tempting
That ignores the folds.
Why it tempts: Forgetting folds is common.
Use case
An illustrative scenario, not a real incident.
Illustrative: knowing the count, the team cuts the grid before burning a day of compute.
See it in different ways
flowchart LR S0["3 × 4 = 12 combinations"] --> S1["12 × 5 folds = 60"] --> S2["Plus 1 final refit"]
How to read this chart
- Read it in order: 3 × 4 = 12 combinations, then 12 × 5 folds = 60, then Plus 1 final refit.
mindmap
root(("Models trained"))
n1["Grid"]
n2["3 × 4 = 12"]
n3["Folds"]
n4["× 5 = 60"]
n5["Refit"]
n6["+ 1"]How to read this chart
- The centre is "Models trained".
- "Grid" covers "3 × 4 = 12".
- "Folds" covers "× 5 = 60".
- "Refit" covers "+ 1".