ML Pipelines in sklearn

Click here to watch a series of videos on building a full machine learning pipeline in sklearn
Author

George I. Hagstrom

Published

September 8, 2026

I have recorded a series of videos on ‘sklearn’. The first video goes over the basic design of the package at a high level. You can watch that video here, ‘sklearn’ design principles it lasts about 20 minutes. If you want to read more content on the thinking behind the ‘sklearn’ API, I suggest this reference paper: API Design for ML.

Then I show an example from Chapter 2 of the Hands on Machine Learning Book, which involves building a machine learning model to predict housing prices in California census blocks using a variety of census data. The notebook from that book can be found here: End-to-End Machine Learning Project. This chapter (and the corresponding notebook) are very long and also comprehensive in terms of the topics covered. They demonstrate many of the features used in deploying a project in sklearn from start to finish (minus some production aspects). Since much of the material is advanced both with respect to the machine learning methodology and the programming concepts used, I made a shorter and less comprehensive version of the same notebook to introduce you to the basics of machine learning pipelines in sklearn. If you are reading Chapter 2, my notebook will follow the development there up until the point where the book talks about hyperparameter optimization, leaving out along the way some concepts. We will return to these more advanced concepts as we proceed through the semester.

I divided the content into a number of videos, which you can access from the table below, including an overview video which quickly goes through the notebook. Watch each section as you need to. I recorded some of these videos last semester (though edited them to make them shorter and to remove some gaffes and phone calls this semester).

Video Link Watch Time
‘sklearn’ Coding Vignette Intro 16:14
‘sklearn’ Coding Vignette: Data Loading 15:37
‘sklearn’ Coding Vignette: Train-Test Split and Stratification 16:21
‘sklearn’ Coding Vignette: EDA and Feature Engineering 15:01
‘sklearn’ Coding Vignette: Missing Values and Imputation 7:15
‘sklearn’ Coding Vignette: One-Hot Encoding, Log-transformations, and Scaling 12:15
‘sklearn’ Coding Vignette: Pipelines and Custom Transformers 11:53
‘sklearn’ Coding Vignette: ‘ColumnTransformer’ and Preprocessing 11:18
‘sklearn’ Coding Vignette: Linear Model Performance 12:55
‘sklearn’ Coding Vignette: Model Diagnostics, ‘kNN’ fit, full pipeline 15:38

You can download the python notebook from the vignette here: MLPipelineVignette.ipynb