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





