liveBook · Manning

Grid search

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

Grid search is an exhaustive hyperparameter optimization technique that evaluates every combination of specified hyperparameter values.

Grid search is an exhaustive hyperparameter optimization technique: define candidate values, test every combination, and select the combination with the best cross-validated result. It works best when the number of hyperparameters is small, values are discrete, and tests can run in parallel on a manageable dataset. section 6.3.1

A practical grid-search workflow includes:

  • Choose a sequence of candidate values for each hyperparameter. section 6.3.1
  • Represent one or more search spaces as dictionaries mapping parameter names to candidate values. section 6.3.1
  • Use pipeline parameter names such as model__penalty when tuning a model inside a pipeline. section 6.3.1
  • Compare the resulting cross-validated scores and retain the best settings. section 6.3.1

Logistic-regression tuning

A Scikit-learn pipeline can test no penalty, L1 or L2 regularization across several C values, and elastic net across C and l1_ratio values. In the demonstrated run, the best result uses no penalty and achieves a cross-validated score of about 0.821. section 6.3.1

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Explains exhaustive combinations, search-grid structure, pipeline naming, validation, and computational limits without detailing the full implementation.
Examples
Uses logistic regression, regularization choices, C values, l1_ratio values, K-fold validation, and a reported score.
What you can do after
Apply it via Scikit-learn's GridSearchCV to select hyperparameters using cross-validated scores.
How it connects
Connects hyperparameter optimization with cross-validation, pipelines, regularization, logistic regression, and manual tuning.

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 Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.