liveBook · Manning

Grid search

As explained in Ensemble Methods for Machine Learning

Grid search is a model-selection method that evaluates combinations from a specified set of parameter values to identify a performant configuration.

Grid search evaluates every selected combination of parameter values, using cross-validation to identify a configuration that performs well. It is useful when parameters interact: a learning rate that works alone may behave differently with another number of estimators. section 4.4.2 section 4.3.2

A practical grid-search workflow is:

  • Choose parameter grids, such as n_estimators values of 200–500 and learning_rate values of 0.6–1.0. section 4.4.2
  • Select a scoring function appropriate to the task; balanced accuracy supports multiclass or imbalanced classification. section 4.4.2
  • Run GridSearchCV with five folds, parallel processing, and refit=True so the best configuration is retrained on all training data. section 4.4.2
  • Inspect the scores and parameters for every combination, then evaluate the selected estimator on held-out test data. section 4.4.2

AdaBoost digit classification

A grid containing four n_estimators values and three learning_rate values tests twelve AdaBoost configurations. The best setting was learning_rate=0.6 and n_estimators=200; the refitted model achieved 0.95 test accuracy on 360 digit examples. section 4.4.2

Exhaustive search is thorough but can be computationally expensive. RandomizedSearchCV tests a smaller sample of combinations and can be faster when the parameter space is large. section 4.4.2 section 7.5

How Ensemble Methods for Machine Learning covers it

How deep it goes
Explains parameter grids, scoring, folds, refitting, result inspection, and computational limits, but not search-theory internals.
Examples
Demonstrates AdaBoost digit classification with learning_rate and n_estimators grids, classification reports, and confusion matrices.
What it assumes
Assumes familiarity with model parameters, training and validation data, cross-validation, and performance scoring.
What you can do after
Apply it via scikit-learn’s GridSearchCV to select, refit, inspect, and test a tuned estimator.
How it connects
Connects cross-validation, hyperparameter selection, AdaBoost, balanced accuracy, and randomized search.

Also explained in

Compare how 6 books explain grid search →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Ensemble Methods for Machine Learning. The section links point to the parts of the book it draws on.