Machine Learning · Module 12 of 12

Tuning, Interpretation & Pitfalls

Lessons

About This Lesson

A working model is rarely the finished one. In this last lesson you'll learn how to make a model better, understand what it has learned, and avoid the mistakes that make results look better than they really are.

You'll start with hyperparameter tuning, using grid search and the faster randomized search to find good settings. Then you'll see how to interpret a model by reading its coefficients, and finally learn a classic pitfall, data leakage, which happens when information from the test data sneaks into training.

Watch the videos in order, then tune a model on a dataset of your own and check that your preprocessing never sees the test set. When you're done, put it all to work in Practice & Projects.

Lessons

4 videos
01

Use cross_val_score and GridSearchCV on a Pipeline

How to cross-validate a pipeline and search over its settings to find the best hyperparameters.

02

Try RandomizedSearchCV if GridSearchCV is taking too long

How randomized search samples settings instead of trying every combination, so tuning finishes much faster.

03

Display the intercept and coefficients for a linear model

How to read the coefficients of a linear model to understand which features push its predictions up or down.

04

Use fit_transform on training data, but transform (only) on testing/new data

How to keep test data out of preprocessing so you avoid data leakage and get an honest score.