Algorithms for Machine Learning & Inference

Course code: TDA231/DIT380


  • May 1. Exam audit (Tentagranskning) will take place May 2nd, 13:00-15:00. Location: Olof’s and Mikael’s office, room 6447 on the sixth floor in the EDIT building.
  • Apr 10. Exam audit (Tentagranskning) will take place May 2nd, 13:00-15:00. Location: TBA.
  • Hand-ins can be delivered to me starting 8 AM, room 6472 until 10 AM.
  • Mar 13. Exam 2017.
  • Mar 12. Tomorrow, March 13th, 10:00, the exam will be published as a pdf file here on the course web page. 24 hours later, your solutions should be handed in on paper in Devdatt’s office: March 14, 10:00.
  • Mar 7. Exam solutions for 2016 published.
  • Mar 2. We have published the exam from 2016 for you to practice. Exam 2016
  • Feb 7. Recommended reading and homework solution sketch for HW1 up: Recommended reading related to today’s lecture (neural networks and convnets) is updated, and there is a solution sketch for HW1.
  • Feb 6. Homework due dates: The due dates for the coming homework assignments have been set. Neural networks: Feb 20th. Support Vector Machines: Feb 27th. K-Means: March 6. There is no homework to submit Feb 13.
  • Jan 31. Rooms for consultation: We have changed the consultations. In time-edit, there are rooms assigned to each consultation time. To have time for all questions, we will go through the assignment parts one by one, and you can ask questions during this process.
  • Jan 31. Consultation guidelines: The consultation hours are there to sort out confusions about the assignments. There are many students in the course this year, and to make sure that we have time to help everyone, we encourage you to think about the following before bringing your questions to the consultations.
    • Read through and start solving the problems, and take notes of what clarifications you need from us.
    • We can not give you the answers to the questions (nor can we tell you if your solution is correct), as your solutions are part of the examination in the course.
  • Exam dates: Exam released March 13 10 AM, due at my office March 14 10 AM.
  • Jan 23. Due to popular demand, we will be available for consultation also on Tuesdays, 13:15-14:00.
  • Jan 18. Assignment submissions are performed in groups of two. You join a group in the Fire system, and then a group member submits on behalf of the group. Questions about Fire can be directed to Olof (mogren at chalmers dot se). If you haven’t found anyone to work with, Aristide (aristide at chalmers dot se) can team you up with a course mate.
  • Jan 12. Homework for first week is now online. See below.
  • Jan 9. Web page for 2017 is live. Stay tuned for updates.

What It’s About

Today we have entered the era of “Big Data” : science, engineering and technology are producing increasingly large data streams, with petabyte and exabyte scales becoming increasingly common. We are flooded with data from the internet, social networks like Facebook and Twitter and high throughput experiments from Biology and Physics labs. Machine Learning is an area of Computer Science which deals with designing algorithms that allow computers to automatically make sense of this data tsunami by extracting interesting patterns and insights from raw data. The goal of this course is to introduce some of the fundamental concepts, techniques and algorithms in modern Machine Learning with special emphasis on Statistical Pattern Recognition. The first few lectures will introduce fundamental concepts, in particular the Bayesian approach, and in the rest we will see them applied to paradigm topics including:

  • Supervised Learning: Bayes Classifier, Support Vector machines, Regression.
  • Unsupervised Learning: Clustering Algorithms, EM algorithm, Mixture models, Kernel methods.
  • Deep Learning: Artificial neural networks, Back-propagation, Convolutional NNs, Recurrent NNs, Deep reinforcement learning
  • Graphical Models: Hidden Markov models, Belief propagation, variational methods, MCMC.



  • Devdatt Dubhashi


  • Mikael Kågebäck (kageback (at), lectures, consultation)
  • Olof Mogren (mogren (at), lectures, consultation)
  • Jonatan Kilhamn (jonkil (at), grading)
  • Aristide Tossou (aristide (at), grading)

Course literature

The course book is S. Rogers and M. Girolami, A First Course in Machine Learning, 2nd edition, Chapman & Hall/CRC 2016, ISBN: 9781498738484.

Student Representatives

  • Tobias Bergström (tobbergs (at)
  • Björn Hedström (hebjorn (at)
  • Heiko Joshua Jungen (jungen (at)
  • Oskar Jönefors (oskjone (at)



For the final grade, the points are normalized and regular passing grades apply. Max total score for all homework assignments: 120. Max total score for exam: 60.

Weighting of the scores:
total_score = total_homework_scores/4 + total_on_exam/2

Grade levels:
28 (3,G) 36 (4) 48 (5, VG)

Take-home exam:

  • Exam released: March 13 10 AM
  • Exam due: March 14 10 AM (hard copy at my office)

Practice exams:


Elementary probability, linear algebra and multivariate calculus. You should be able to program in MATLAB. Previous algorithms courses are valuable though not strictly necessary. Here are some refreshers:

See also [Bar Ch. 29] for a refresher on linear algebra and multivariate calculus, and [Bar Ch.1] for a probability refresher.

Matlab resources: Here is a Matlab tutorial.


Lecture slides will appear here as the course progresses, together with recommendations for reading.

Note that the lecture slides are subject to change until the day of the lecture.

Day Main lecture topics and slides Slides Recommended reading Room for consultation
Jan. 17 Machine Learning – What, Why and How? Lecture 1
Jan. 20 Bayesian Concept Learning; Binomial Dist. and Inference Lecture 2  [RG, 2.3, 3.1-3.3]
Jan. 24 Gaussian Distribution and Inference Lecture 3, Extra  [RG, 2.5, 2.8.2], Multivariate Gaussians, Chuong B. Do
Jan. 27 Linear Regression Lecture 4A, Lecture 4B [RG 1.1, 1.2, 2.1-2.11,3.1 – 3.8] [Mur. 7.1-7.3, 7.6], [Bar 17.1, 17.2]
Jan. 31 Classification 1: Bayes and Naive Bayes Lecture 5A, Lecture 5B [RG 5.2.1] [Mur. 3.5], [Bar Ch. 10]
Feb. 3 Classification 2: Logistic Regression Lecture 6 (and 9) [RG 5.2.2] [Mur. Ch 8], [Bar Ch. 17.4.1] EL43
Feb. 7 Introduction to artificial neural networks, Convolutional neural networks. Lecture 7a, Lecture 7b. [GBC Ch6-ch9] N/A
Feb. 10 Feed forward neural networks and recurrent neural networks. Lecture notes, FFNN slides, RRN slides. ML13
Feb. 14 MCMC, HMMs(brief)  Lecture 6 above  [RG, Ch.9], [Mur 24.3],[Bar. 27.4] EL43
Feb. 17 SVMs I Lecture 10 (and 11)  [RG 5.3, 5.4], [Mur. 14.5], [Bar. Ch. 14, 17] EL42
Feb. 21 SVMs and Kernel Methods See above EL43
Feb. 24 Clustering: K means Lecture 12  [RG Ch.6], [Mur. Ch. 11] [Bar. Ch. 20] ML13
Feb. 28 Mixture models and EM  see above  [RG Ch.6], [Mur. Ch. 11] [Bar. Ch. 20] ES52
Mar. 3 PCA and Autoencoders PCA, Autoencoders PCA web demo, PCA notes (Mark Richardson) ES52
Mar. 10 Deep Reinforcement Learning No consultation this week.

Homework assignments

Link to FIRE:

  • All assignments will be posted here.
  • All assignments are to be solved in pairs. If you don’t have a partner, Aristide can team you up with one.
  • Each homework consists of both theoretical and practical problems.
  • You will need to upload two things to FIRE,
    • One .pdf-file containing the solutions to the theoretical problems and discussion of practical results (including result plots)
    • One .zip/bzip/gzip-file containing the source code to the practical part
  • Assignment .pdf:s may be subject to minor changes (such as spelling corrections) up until one week before the deadline.
Homework Due date Datasets Code skeletons Grader Solution sketch
HW0 Jan. 23 dataset0.txt Aristide
HW1 Jan. 30 dataset1.mat sge.m Jonatan solution-sketch.pdf
HW2 Feb. 6 dataset2.mat digits.mat Jonatan solution-sketch.pdf
HW3 Feb. 20 data.mat, net.m Aristide
HW4 Feb. 27 d1b.mat d2.mat Jonatan solution-sketch.pdf
HW5 Mar. 6 hw5_p1a.mat, hw5_p1b.mat, medium_100_10k.mat Aristide solution-sketch.pdf

Machine learning software

In this course, the practical homework assignments are designed to be solved with Matlab.

When working with the topics you’ve learned in this course however, you don’t need to write all parts of the implementation yourself. There are many mature libraries to use for applying machine learning. Two libraries that strive to be general, and therefore has many implemented algorithms, are scikit-learn (Python) and Weka (Java).

For deep learning, e.g. TensorFlow (Python), Theano (Python), Torch (Lua) and DL4J (Java).

If you are working in a context that uses the Apache big data tools, e.g. the Hadoop ecosystem, there are machine learning libraries on top of these general processing frameworks. Most notable Mahout, Spark, and FlinkML.

It is important to stress that using these libraries is fairly easy, but without the proper theoretical understanding of what is happening behind the scenes, you will not have the same success applying and extending these tools to your specific problem. This is why we will not use these libraries directly in this course but we will provide pointers for you to try them out if you’re interested.