Hyperparameter Tuning in Python
Learn to tune machine learning hyperparameters in Python with grid search, random search, and Bayesian and genetic methods using Scikit Learn.
Hyperparameter tuning is the work of choosing the settings that shape how a machine learning model learns, and doing it by hand quickly becomes impractical as models gain more options. You first separate the values a model learns during training from the ones you set beforehand. Then you automate the search for good settings with Scikit Learn, comparing exhaustive and random sampling before trying Bayesian and genetic algorithms.
What You Will Achieve
- Pull learned parameters out of fitted logistic regression and random forest models
- Plot how model performance changes as a single hyperparameter value is varied
- Choose between grid and random search for a problem, then read and reuse the best settings each one finds
- Apply Bayesian and genetic algorithms to narrow down hyperparameter settings
Program Overview
Model Parameters and Hyperparameter Values
Separates what a model learns in training from the settings chosen beforehand, using logistic regression, random forest and KNN examples.
- Parameters in logistic regression and random forests
- Hyperparameters of random forests and KNN
- Tips on which hyperparameters to tune
- Automating hyperparameter choice with learning curves
Grid Search and Random Search in Scikit Learn
Covers the two uninformed search methods, how each samples combinations, and how to read and compare their output.
- Writing grid search functions and counting models
- GridSearchCV inputs and output
- RandomizedSearchCV and visualizing a random search
- Grid and random search side by side
Informed Search Methods
Gives a first look at informed search and how it differs from uninformed approaches, with practice in each method.
- Coarse to fine iterations
- Bayes rule and Bayesian tuning with Hyperopt
- Genetic hyperparameter tuning with TPOT
- Checking the stability of TPOT results
Certificate Awarded (Paid)
Job Outlook
Tuning model settings is routine work for data scientists and machine learning scientists who build predictive models in Python and need them to perform well on a specific problem.
Good for: Data scientists and machine learning practitioners who want to stop setting model options by hand and search for them systematically.
Keep in mind: The final chapter only gives a first taste of Bayesian and genetic tuning, so expect to read further before using Hyperopt or TPOT on real projects.
Bottom line: Its side-by-side comparison of grid and random search, followed by Hyperopt and TPOT, maps out the main automated tuning options in Python.
Frequently Asked Questions
What is the difference between a parameter and a hyperparameter?
A parameter is a value the model learns while it trains, such as the ones the first chapter extracts from logistic regression and random forest models. A hyperparameter is a setting you choose before training starts, and the course practices setting them for random forests and KNN.
Which Python libraries do the exercises use?
Scikit Learn carries most of the work, through its GridSearchCV and RandomizedSearchCV tools. The last chapter adds Hyperopt for Bayesian hyperparameter tuning and TPOT for genetic tuning.
How does random search differ from grid search?
Grid search tries every combination in the grid you define, and one lesson counts how many models that produces. Random search samples combinations at random, which the course presents as more efficient in large parameter spaces, and a chapter runs the two side by side.
Do I need to install Hyperopt or TPOT on my computer?
No. The coding exercises run inside the course browser, so there is no software to download or set up on your own machine before you start.


There are no reviews yet.