A hands-on introduction to modern pattern recognition. We begin in medias res by training two intuitive classifiers (a perceptron and a kNN classifier) to recognize digits. To determine which one is better we must state what "better" means, so we introduce "generalization." To talk about generalization we need to build the probabilistic framework in which modern pattern recognition resides. From here the plan is clear: we imagine that probabilistic descriptions of data (that is, the knowledge) is given to us and derive optimal classifiers. We then move to supervised learning from training samples, linear classification and regression, feature design (especially the multiscale or spectral perspective which has seen great success for images, audio, text, ..., and which has beautiful connections to physics). We apply our probabilistic models to problems in image restoration—denoising, demosaicking, deblurring, as well as—time permitting—segmentation. We then eschew feature design in favor of deep neural networks. Finally, we pivot back to solid ground and ask: what good are probabilistic description of the world if we cannot generate samples from them? This leads us to consider sampling methods such as Markov chain Monte Carlo.


W Topic Additional material Assignment

T: Introduction: the ingredients (slidesvideo 1video 2)
F: k-Nearest neighbors, curse of dimensionality (video)

Lecture notes

Recitation: A refresher on linear algebra and probability (ipynb)


Notebook: k-Nearest Neigbours

Chapter 1 [PPA]
Chapter 1.4.1-1.4.3 [MML]
Chapter 1.4.7 in [MML]


Sample assignment (link)  


T: Curse of dimensionality, perceptron (video 1, video 2)
F: Perceptron, decision theory (video 1, video 2)

Lecture notes

Recitation: Sample assignment hints & Gradescope help 


Notebooks: MNIST & PerceptronCat and Dog People

Chapter 2 in [PPA]
Chapter 5.7 in [MML]

On Frank Rosenblatt


Sample assignment due - 28.09

Assignment 1 released (pdf, codes)


T: Decision theory, optimal classification (video 1, video 2)
F: Likelihood ratio tests, ROC curves (video 1, video 2)

Lecture notes

Recitation: 1st assignment hints 


Notebook:  Needle in a Haystack

Chapter 2 in [PPA]
Chapter 5.7 in [MML]





T: ROC curves, linear regression (video 1, video 2)
F: multivariate linear regression (video 1, video 2)

Lecture notes

Recitation: Solve sample assignment 

Notebook:  Linear and logistic regression  

Chapter 2 in [PPA]
Chapter 5.7 in [MML]
Chapter 7 in [MML]

Grade sample assignment - 09.10

1st assignment due - 12.10 

Assignment 2 released (pdf, code)


T: geometric and probabilistic perspectives on linear regression + MNIST and one-hot encoding (video 1, video 2)
F: interpretations of one-hot encodings, logistic regression (video 1, video 2)

Lecture notes

Recitation: 2nd assignment hints 

Notebook:  Logistic regression scribbles  

Chapter 7 in [MML]

Chapter 8 in [MML]

Grade 1st assignment - 16.10 



T: logistic regression, gradient descent (video 1, video 2, video 3)
F: recap logistic regression, edge detection and convolution (video 1, video 2)

Lecture notes

Recitation: Solve 1st assignment 

Notebook:  Edge detection

Chapter 7 in [MML]

Chapter 8 in [MML]

2nd assignment due - 26.10

Assignment 3 released (pdf, code)


T: convolution, DTFT, DFT (video; NB: unfortunately the microphone was off during the initial recap part; notes will cover it)
F: Convolution, DTFT, DFT (video 1, video 2)

Lecture notes

Recitation: 3rd assignment hints 

Notebook: Convolution and Fourier transform

Discrete Fourier Transform (link)

Chapter 3 in [FSP]




T: Fourier transform interpretations + Wiener filtering (video 1, video 2)
F: A multivariate Gaussian intermezzo and Wiener filtering (video 1, video 2)

Lecture notes


Recitation: Solve 2nd assignment

Chapter 3 in [FSP]

Grade 2nd assignment - 06.11 

3rd assignment due - 09.11

Assignment 4 released (pdf, code)


T: machine learning bootcamp 1 (notebook,video)
F: machine learning bootcamp 2 (notebook, video)

Recitation: 4th assignment hints 

OpenOndemand portal (VPN required)

Scicore cluster install instructions



Grade 3rd assignment - 13.11



T: unsupervised learning, autoencoders (video 1, video 2)

Recitation: Solve 3rd assignmnet 


4th assignment due - 23.11

Assignment 5 released (pdf, code)


F: autoencoders and PCA (video 1, video 2)

Recitation: 5th assignment hints

Lecture notes 


Grade 4th assignment - 27.11



T: nonlinear (deep) autoencoders (video 1, video 2)
F: towards generative models (video)

Lecture notes 

Recitation: Solve 4th assignment


5th assignment due - 07.12

Assignment 6 released (pdf, code)


T: variational autoencoders (video 1, video 2)
F: variational autoencoders (video 1, video 2)

Lecture notes 

Recitation:  6th assignment hints

Practice exam


Grade 5th assignment - 11.12



T: transformers (video)

Lecture notes 

Recitation: Solve 5th assignment



6th assignment due - 21.12




We will assume familiarity with basic probability and linear algebra. We will review the most important concepts along the way but these reviews cannot replace entire courses. All programming examples and assignments will be in Python.


The course materials will be posted to this gitlab repo. While we will provide the required notes and recordings, we will also recommend reading from textbooks and other sources that are freely available online.

[MML] Machine Learning: A Probabilistic Perspective (2012) by Kevin Murphy; see also newer books by the same author, available online.

[ESL] Elements of Statistical Learning by Hastie, Tibshirani, and Friedman: A legendary ML textbook. See also a shorter introductory text by the same authors, Introduction to Statistical Learning.

[PPA] Patterns, Predictions, and Actions: A graduate textbook by Moritz Hardt and Ben Recht, somewhat advanced for this course but great reading nonetheless if you like that sort of stuff and you're not seeing it for the first time.

[FPS] Foundations of Signal Processing: A signal processing textbook by Vetterli, Kovaˇcevi´c and Goyal.

[CVAA] Computer Vision: Algorithms and Applications,  2nd Edition, by Richard Szeleski.

[ISL] An Introduction to Statistical Learning with Applications in Python by James, Witten, Hastie, Tibshirani and Taylor.


Math Resources:

The course uses a lot of probability and linear algebra; hence to be comfortable with the basics, we provide links to supplementary materials.  However, for a much more comprehensive set of resources, you can find them in  Jonathan Shewchuk's 'Introduction to Machine Learning' course. For your convinience, we have included some of those links below:

For discussions about the lectures and excercises you can use the Piazza forum. Please do not send e-mail unless you're asking a really personal question

Both coding and written assignments must be submitted through Gradescope.



Class time and location

Tuesday lecture will be given in Kollegienhaus, Hörsaal 118 and Friday lecture will be in Kollegienhaus, Hörsaal 115.

Tuesday lecture takes place from 08.15 am to 10.00 am. Friday lecture takes place from 10.15 am to 12.00 pm.

Exercise sessions will take place on Monday, 2.15 pm - 4.00 pm in Pharmazentrum, Labor U1075 and Wednesday, 4.15 pm - 6.00pm in Spiegelgasse 5, Seminarraum 05.002.





Prof. Dr. Ivan Dokmanić: ivan.dokmanic[at]unibas.ch


Teaching assistants

Roman Fries: r.fries[at]unibas.ch

Alexandra Spitzer: alexandra.spitzer[at]stud.unibas.ch

Vinith Kishore: vinith.kishore[at]unibas.ch

Cheng Shi: cheng.shi[at]unibas.ch

Valentin Debarnot: valentin.debarnot[at]unibas.ch