What This Course Is For
scikit-learn is the library most Python machine learning work runs on. Its models share one interface, so once you can fit, tune, inspect and save one of them, you can do the same with any of them. Most mistakes in practice are not in the model at all: a statistic learned from rows that should have stayed hidden, a score measured on the wrong rows, a threshold left at its default, a model file loaded from somewhere it should not have come from.
This course teaches you to run a scikit-learn workflow correctly and to say why each step is right. You start with the estimator interface itself, then data and splits, then preprocessing that cannot leak. You train and compare regression models and classifiers, use the model selection machinery to tune them without touching the test rows, apply clustering and dimensionality reduction, inspect what a fitted model learned, save it safely and reuse it from a small command-line program. A module on diagnosing failures from their messages and a final challenge finish the course.
The aim is not to memorise classes. It is to predict what a call will do before you run it, run it, and check the result against something you know to be true: a learned statistic, a hand-computed metric, an assertion.
Who It Is For
You should be able to write Python at the level of a short script: a function, a loop, a dictionary, a list. You should be able to read a NumPy array's shape and select a column of a pandas DataFrame; the lessons explain the few array and table operations they need, and nothing more. You should be able to run a command in a terminal and save a text file under a given name.
You do not need to have used scikit-learn. You do not need statistics or linear algebra beyond arithmetic: the lessons explain what a metric measures, not how to derive it. If you have never written Python, start with the Python for AI and Machine Learning course first; its last module builds one scikit-learn pipeline, which this course deepens from its third lesson.
How the Lessons Build on Each Other

Read the diagram from top to bottom. Each arrow means the next module uses
what the previous one taught. The estimator contract comes first because
every later call is fit, predict or transform on some object that
follows it. Data and splits come before preprocessing so that the
preprocessing lessons can say why every learned step follows the split.
Regression comes before classification because its metrics need no decision
threshold; the classification module then adds scores, curves and the
threshold. Model selection follows both, so that cross-validation and
searches can be applied to pipelines you have already built. Clustering and
principal component analysis (PCA), inspection and persistence each use the pipelines and searches from
earlier modules. The diagnosis module collects failures you met one at a time
and makes you fix them from their messages alone.
The Final Challenge is one task that combines the core skills without step-by-step instructions. Nothing in the course is optional: every module serves it.
Three Ways to Study a Lesson
Every lesson has three views of the same material:
- Full Course teaches the topic: the problem, how it works, a worked example with the code explained and, in practical lessons, an exercise you do yourself.
- Revision helps you recall the reasoning after you have studied the Full Course: the distinctions, the decisions and the common mistakes.
- Quick Reference lists the code patterns and decisions in a compact form, with the warnings that apply to them.
Start with Full Course. The shorter views are for returning to a topic, not for skipping it.
How the Practice Works
Practical lessons end with an exercise that runs on your computer. The setup
lesson creates a practice folder called sklearn-practice in your home
folder, with one Python environment inside it that holds the exact library
versions the lessons were checked against. Each lesson then gets its own
subfolder named after the lesson.
You write code in your editor and run it from the terminal. Most files are given in full: the lesson shows the file with its name, you save it under that name, run it and compare its printed values with the ones the lesson states. Then you change something, predict the effect, and run it again. The lesson explains each block of code: what goes in, what the important lines do, what comes out and what changing a value would change.
The data is either bundled with scikit-learn or generated by small scripts with fixed seeds, so every learner works with the same values. Nothing is downloaded after the setup and nothing is sent anywhere. Several lessons use a fictional bike-share operator, Rivermead Cycles: a table of daily rentals for regression, a table of docks that may fail within 30 days for classification, station groups for clustering. The data is synthetic; the decisions are the point.
Output shown in the lessons is marked illustrative: most values should match exactly, but timings, folder paths and some details of warning messages differ between computers and Python versions. Each lesson says which values to compare.
If an exercise goes wrong, you can start it again: remove that lesson's subfolder and save its files once more. Each exercise ends with a cleanup step that removes only its own subfolder, after you confirm you are in the right place. The Python environment stays until the end of the course; the final challenge explains how to remove the whole practice folder when you have finished.
Checking Your Own Work
Each exercise says how to check the result: usually by comparing printed values with the ones the lesson states, sometimes by an assertion in the script, and in two lessons by running supplied tests. A script that finishes without an error is not enough. The check is whether its results are right, and whether you can say why.
Questions have a Your answer box. Write your answer before opening the reasoning; comparing afterwards shows what you actually understood.
There is no automatic grading. Marking a lesson complete records your reading progress; it does not prove you can do the task.
What the Course Leaves Out
The course does not teach Python, NumPy or pandas beyond the bridges the lessons need, deep learning or GPUs, text features and advanced feature engineering, probability calibration, experiment tracking or model serving, time-series forecasting libraries, or statistical theory. Three of those have their own courses: Python for AI and Machine Learning, Feature Engineering and Model Evaluation, and the MLOps Engineering path. Where a lesson here touches one of their topics, it teaches the scikit-learn call and points onward.
scikit-learn's own documentation is the authority the lessons cite: its user guide for every chapter the course covers, and its "choosing the right estimator" map, which a later lesson uses as a decision aid. The lessons tell you which page to open when you want more than the course gives.
Readiness Check
Predict what this script prints before you read on:
rentals = {"Mon": 1210, "Tue": 1180, "Sat": 1540, "Sun": 1495}
def busy_days(counts, limit):
busy = []
for day, count in counts.items():
if count > limit:
busy.append(day)
return busy
print(busy_days(rentals, 1300))
print(len(busy_days(rentals, 1100)))
The answer is ['Sat', 'Sun'] and then 4: with the limit 1300 only the two
weekend days are above it, and with the limit 1100 every day is, so the list
has four entries. If you followed the function, the loop and the dictionary
without trouble, you are ready for the Python in this course.
Two more checks, on the libraries the course assumes at reading level. If
values is np.array([[1, 2, 3], [4, 5, 6]]), then values.shape is
(2, 3): two rows, three columns. If table is a DataFrame with a column
named rentals, then table["rentals"] is that one column, a Series, and
table[["rentals"]] is a DataFrame with one column. If both are familiar,
start the setup lesson. If not, the Python for AI and Machine Learning course
teaches them.
Check Your Understanding
-
Predict what this prints, then explain each line:
counts = {"A": 3, "B": 0, "C": 5} total = 0 for name, count in counts.items(): if count > 0: total = total + count print(total, len(counts)) -
rowsisnp.array([[2.5, 1.0], [3.5, 0.0], [4.0, 2.0]]). What isrows.shape, and what doesrows[:, 0]select?
Answer and Reasoning
Understanding check
- It prints
8 3. The loop visits the three entries in order;Bhas a count of 0, which is not greater than 0, so only 3 and 5 are added, giving 8.len(counts)counts entries in the dictionary, not the ones that passed the condition, so it is 3. rows.shapeis(3, 2): three rows and two columns.rows[:, 0]selects every row (:) of column 0, giving the one-dimensional array[2.5, 3.5, 4.0]. The lessons use this form when they pull one column of a matrix of scores, such as the probability of the positive class.