GridSearchCV and RandomizedSearchCV both search the same
space of hyperparameter combinations, cross-validating each candidate to estimate
how well it generalizes. This scene turns that abstract search into a landscape:
the hilltops are combinations of two hyperparameters (learning rate and
max_depth-style regularization) that generalize well, and the low
plains are combinations that underfit or overfit.
k-fold cross-validation is simulated by adding random per-fold jitter to the true score — more folds average that jitter away, giving a steadier estimate..best_params_ and .best_score_ after .fit().n×n param grid).Bergstra & Bengio (2012) showed that random search often outperforms grid search under a fixed compute budget precisely because most hyperparameters barely affect the outcome — random sampling explores the few important dimensions far more densely than an evenly-spaced grid ever can.
GridSearchCV and RandomizedSearchCV both cross-validate candidate hyperparameter combinations against a hidden generalization landscape — this scene renders that landscape in 3D and drops glowing markers as each strategy evaluates it.
Grid search lays candidates on an evenly spaced lattice and evaluates all of them; randomized search spends the same budget on random draws, often finding a comparably good peak with far fewer evaluations.
Pick a search strategy and budget, set the number of CV folds to see how estimate noise shrinks, then press Run search and watch candidates populate the surface as the best score and parameters update live.
Bergstra & Bengio's 2012 paper showed random search reliably beats grid search under a fixed compute budget, because most models are only sensitive to a handful of the hyperparameters being tuned.