Free through lesson 3

Python & Machine Learning for Beginners

From NumPy and pandas through visualisation, preprocessing, regression, classification, model evaluation and unsupervised learning, all the way to PyTorch and LLMs. Fifty lessons that take you to the point where you can clean data, build a model, and translate its numbers back into the language of the business. Every output shown is a real result from actually running the code.

Curriculum

The 50 lessons are grouped into seven chapters. Working through them in order is the best way, but you are welcome to dip into whatever interests you. Note: because these lessons use numpy, pandas and scikit-learn, they cannot run in the browser. Use the virtual environment you create in lesson 2, or a Jupyter notebook.

Chapter 1 — Getting started and NumPy (lessons 1–4)

You sort out what machine learning actually automates, set up an environment, and get comfortable with NumPy arrays. Reading shapes and understanding broadcasting are foundations you will use from here on.

Chapter 2 — Working with data and visualising it (lessons 5–13)

Read a CSV, aggregate it, join it, clean up missing values and outliers, and check the result on a chart. You finish by taking 408 rows of messy sales data through all three steps: understand, clean, analyse.

5

Getting started with pandas: Series and DataFrame

A labelled one-dimensional thing is a Series; a table of them is a DataFrame. The three methods to call the moment you load data.

🔒 Basic
6

Loading CSV and filtering on several conditions

What to do first after read_csv, combining conditions with & and |, and when to use loc versus iloc.

🔒 Basic
7

Aggregating with groupby

Sales per store in one line. Multiple keys, agg and pivot_table, and transform for putting an aggregate back onto the original rows.

🔒 Basic
8

Combining data with merge and concat

merge joins sideways, concat stacks downwards. Preventing rows silently appearing or vanishing by checking the row count afterwards.

🔒 Basic
9

Handling missing values

Working out what is missing and where, then deciding whether to drop or fill. Carrying the training set's values through with SimpleImputer.

🔒 Basic
10

Cleaning outliers, duplicates and types

The difference between the IQR and three-sigma methods, finding duplicate rows, and fixing numbers with commas and inconsistent spellings.

🔒 Basic
11

Visualising with matplotlib

When to use a line, bar, scatter or histogram, and the basic form of subplots for putting several charts side by side.

🔒 Basic
12

Distributions and correlations with seaborn

seaborn draws from a DataFrame and column names alone. The difference between boxplot and violinplot, correlation heatmaps, and pairplot.

🔒 Basic
13

[Project] Exploratory analysis of sales data

Taking 408 rows of sales data with missing values, duplicates, outliers and inconsistent spellings through all three steps: understand, clean, analyse.

🔒 Basic

Chapter 3 — Machine learning fundamentals (lessons 14–22)

From why you split training and test data, through linear regression, evaluation metrics, scaling and pipelines. You finish by building a complete house price model on data that mixes numeric and categorical features.

14

Machine learning terminology and types

Telling classification, regression and clustering apart by looking at the code side by side. Including the difference between a parameter and a hyperparameter.

🔒 Basic
15

The common scikit-learn API

Models go fit, predict, score; preprocessing goes fit, transform. The way you write it never changes with the algorithm.

🔒 Basic
16

Training data, test data and generalisation

The three arguments to train_test_split, and the moment overfitting becomes visible in the numbers. Time series data is split by date.

🔒 Basic
17

Linear regression and least squares

Reading coef_ and intercept_, interpreting the coefficients of a multiple regression, and confirming for yourself the line that minimises the residual sum of squares.

🔒 Basic
18

Regression metrics (MAE, RMSE and R-squared)

When to use MAE and when RMSE, what R-squared actually means, and why none of it tells you anything without a baseline to compare against.

🔒 Basic
19

Feature scaling

One extra line of preprocessing takes accuracy from 0.722 to 0.963. When to use each of the three scalers, and the ordering you must never use.

🔒 Basic
20

Encoding categorical variables

Choosing between one-hot and ordinal comes down to one question: does the ordering mean anything? Plus what to do with high-cardinality columns.

🔒 Basic
21

Pipelines and ColumnTransformer

Combining preprocessing and the model into one, and removing the very path by which you could fit on the test set. Different treatment per column, unified into one object.

🔒 Basic
22

[Project] Predict house prices (regression)

Explore, build a pipeline, compare, interpret. Building a complete regression model on 600 records mixing numeric and categorical features.

🔒 Basic

Chapter 4 — Classification and algorithms (lessons 23–30)

From logistic regression through k-nearest neighbours, decision trees, random forests, gradient boosting and SVMs, comparing the main classification tools by measurement. This is also where you learn to spot the cases where accuracy cannot be trusted.

23

Logistic regression (the basics of classification)

Why something called regression does classification. How the sigmoid turns a linear output into a probability, and how to read the coefficients.

🔒 Basic
24

Classification metrics (precision, recall and F1)

A model can be 97% accurate and still useless. Precision is how rarely you swing at nothing; recall is how rarely you miss.

🔒 Basic
25

Confusion matrices, ROC curves and AUC

Seeing where it went wrong in the confusion matrix, measuring threshold-independent performance with AUC, and finally moving the threshold itself.

🔒 Basic
26

k-nearest neighbours

A majority vote among the k nearest points. How to choose k, why it weakens as dimensions grow, and the fact that prediction is slower than training.

🔒 Basic
27

Decision trees and pruning

You can read the trained result straight off as if-statement rules. How splits are chosen, and dealing with the overfitting that is guaranteed if you leave it alone.

🔒 Basic
28

Random forests

Gather a crowd of weak trees, take a majority vote, and the result is strong. What makes the trees differ from one another, and the OOB score as a useful by-product.

🔒 Basic
29

Gradient boosting

Each tree learns the residuals of the last. The relationship between learning rate and number of trees, and letting early stopping choose the count for you.

🔒 Basic
30

Support vector machines

Choosing the boundary with the widest margin. How a kernel draws a curved boundary, and how C and gamma behave.

🔒 Basic

Chapter 5 — Improving your models (lessons 31–36)

Damp down the noise in your evaluation with cross-validation, choose parameters by search, and deal with overfitting and class imbalance. You finish a churn prediction model by setting its threshold from expected profit.

Chapter 6 — Unsupervised learning (lessons 37–42)

Group data that has no labels, reduce its dimensions, and find the anomalies. You finish by splitting 1,300 customers into segments and giving each one a name and a plan of action.

Chapter 7 — Deep learning and applied AI (lessons 43–50)

You check what is inside a neural network using nothing but NumPy, then write a training loop and a CNN in PyTorch. The chapter closes with text processing, LLMs, saving and deploying models, and a look back over all 50 lessons.

43

How a neural network works

Computing the forward pass with nothing but NumPy and turning the gradient descent by hand. Without an activation function, any number of layers is just linear regression.

🔒 Basic
44

Getting started with PyTorch: tensors and autograd

Tensors, which are almost NumPy arrays, autograd for computing gradients automatically, and defining a model with nn.Module.

🔒 Basic
45

Writing a PyTorch training loop

Five lines: zero_grad, forward, loss, backward, step. That sequence is the same for a CNN and for a Transformer.

🔒 Basic
46

CNNs and image classification

A fully connected layer throws away spatial relationships and explodes the parameter count. How convolution solves that, and the reality that it is not always the stronger choice.

🔒 Basic
47

Techniques that stabilise training (dropout and early stopping)

Reining in the extreme overfitting you get from 73,985 parameters and 280 records, with four countermeasures. Early stopping is not implemented until you restore the weights.

🔒 Basic
48

Text data and TF-IDF

The classic, still-current way of turning text into numbers. How it favours rare words, and the limits of not understanding meaning.

🔒 Basic
49

Large language models and using their APIs

Zero-shot classification with no training data at all. And the crossover point beyond which traditional methods win as your data grows.

🔒 Basic
50

Saving and deploying models, and wrapping up

Save the whole pipeline, and consider batch processing first. Then build something that tells you when accuracy drifts after launch.

🔒 Basic

Once you have finished all 50 lessons, learn the server side that runs your models in Linux for Beginners, and how to serve predictions from a web app in Django for Beginners. Membership unlocks every course.