How does grid search look for good hyperparameters?
Show the answer and explanation
Correct answer: A, It evaluates every combination of the candidate values listed for each hyperparameter and keeps the best-scoring one.
Explanation Hyperparameter Tuning
Grid search is exhaustive: you list candidate values for each hyperparameter, it forms the Cartesian product of those lists, evaluates every combination (usually with cross-validation) and keeps the best one. In scikit-learn this is GridSearchCV.
Why the other descriptions are wrong:
- Sampling a fixed number of random configurations is random search.
- Fitting a probabilistic model of the score to choose the next trial is Bayesian optimization.
- Following the gradient of the validation loss is gradient-based tuning; grid search uses no gradients and works for discrete settings too.
The cost grows multiplicatively: 4 hyperparameters with 5 values each already give 5⁴ = 625 combinations, before multiplying by the number of CV folds.
Interview tip: say grid search is simple and reproducible but scales badly with the number of hyperparameters, which is why random search or Bayesian optimization is preferred for large spaces.