Introduction to Machine Learning

KU Leuven, campuses Diepenbeek and Geel, academic year 2026-2027

This page collects the slides and the exercise notebooks of the course. The course consists of nine lectures and four exercise sessions of two hours each, and the exercise sessions follow lectures 2, 4, 6 and 8. Each session is added here in the week in which it is taught.

Lectures

The slides open in the browser. Pressing Esc shows an overview of the deck. To save a deck as a PDF, add ?print-pdf to its address and print the page from Chrome.

  1. Introduction and linear regression
  2. Polynomial regression and regularisation
  3. Classification and logistic regression
  4. Decision trees and ensembles
  5. Neural networks 1
  6. Neural networks 2
  7. Convolutional neural networks
  8. Recurrent neural networks
  9. Unsupervised learning

Exercises

Each exercise is a Jupyter notebook that runs in Google Colab, which needs a Google account. Download the notebook, open Colab, choose File, Upload notebook, and select the downloaded file. The first code cell installs the course package and is run before any other. To work on your own computer instead, see below.

Project

In pairs, you classify photos of hand gestures. The brief (PDF) states the task, the rules and the deadlines. The starter notebook loads the data and runs a baseline. Report templates: LaTeX, Word.

Running the notebooks on your own computer

The notebooks also run on your own computer, without Colab or a Google account. The tool uv installs Python, the course package and Jupyter. The setup takes about 1 GB of disk and is done once. All commands are typed in a terminal: PowerShell on Windows (search for it in the Start menu), Terminal on macOS (in Applications, Utilities), and the terminal of your distribution on Linux. Students who already use conda can use the conda environment described in the README of the repository instead.

1. Install uv

On Windows:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

On macOS and Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

Then close the terminal and open a new one, so that it finds uv.

2. Create the environment

These commands create a folder ml-course in your home folder and a Python environment inside it. uv downloads Python 3.12 itself, so an existing Python is not needed.

mkdir ml-course
cd ml-course
uv venv --python 3.12

On Linux only, install the CPU version of PyTorch first. Without this step, Linux downloads the GPU version, several gigabytes that the exercises do not need. Windows and macOS skip this step.

uv pip install torch --index-url https://download.pytorch.org/whl/cpu

On every system, install Jupyter and the course package with its dependencies:

uv pip install jupyterlab "mlcourse @ https://gitlab.kuleuven.be/u0129795/ml2627/-/archive/main/ml2627-main.zip"

3. Open a notebook

Download the notebook from this page and move it from your Downloads folder into ml-course. Then start Jupyter from the ml-course folder:

uv run jupyter lab

Jupyter opens in the browser and lists the folder. Double-click the notebook to open it and run its first cell, which finds the course package and installs nothing. Pressing Ctrl+C twice in the terminal stops Jupyter. Next time, open a terminal, type cd ml-course and start Jupyter again.

4. Update the course package

Each exercise brings new checks in the course package. When a new exercise is released, run this in ml-course before opening it:

uv pip install --refresh-package mlcourse --reinstall-package mlcourse "mlcourse @ https://gitlab.kuleuven.be/u0129795/ml2627/-/archive/main/ml2627-main.zip"

Repository

All released material is also kept in the public repository gitlab.kuleuven.be/u0129795/ml2627. It holds the slides, the notebooks, the course package mlcourse and the datasets of the exercises. A copy of the repository works offline, since each deck at slides/lecture-NN/index.html opens directly in a browser. The repository is downloaded as a zip archive from its page, or cloned with git:

git clone https://gitlab.kuleuven.be/u0129795/ml2627.git

Reading

The course follows three books, and a fourth for lecture 8, all free to read online. The last slide of each lecture lists the chapters that match it.