Official course description:
Full info last published 23/11-20

Probabilistic Programming

Course info
ECTS points:
Course code:
Participants max:
Offered to guest students:
Offered to exchange students:
Offered as a single subject:
Price (single subject):
10625 DKK (incl. vat)
MSc. Master
MSc in Computer Science
Course manager
Full Professor
Teaching Assistant
Teaching Assistant (TA)
Course semester
Forår 2021
1 February 2021
14 May 2021
Exam type
ekstern censur
Grade Scale
bestået/ikke bestået
Exam Language
This course introduces basics of Bayesian statistics, Bayesian data analysis, Bayesian learning, and the programming tools that enable automation of these methods. The course emphasizes programmable statistical methods over pen and pencil analytics.

Bayesian statistics and probabilistic programming are believed to be the proper foundation for development and industrialization of next generation of AI systems.  Bayesian statistics gives a well defined theoretical basis, that is analytically understandable, while probabilistic programming gives an instrument of automation, needed for proper industrialization of the method.

This course introduces basics of Bayesian statistics, Bayesian data analysis, Bayesian learning, Bayesian Hypothesis testing, and the programming tools that enable automation of these methods.  We will cover Bayesian reasoning and diagnosis and build models of concrete examples.  We will learn several sampling methods and apply them to problems at hand.  The course emphasizes programmable statistical methods over pen and pencil analytics.    Every week we solve a programing exercise associated with the topic of the lecture. 

We will study Bayesian Analysis using an established textbook.  For each chapter we will implement examples and exercises of models and analyses using Python's PyMC3 framework - probably the most popular probabilistic library today. Occasionally we will show examples of other probabilistic programming languages to illustrate concepts.

Formal prerequisites
  • You need to be a confident programmer in object-oriented and functional programming styles
  • You should know basic probability theory at high-school level (concepts like discrete probability, or normal distribution).  We will recall all the necessary notions in the course, but we will not provide a systematic course on probability theory. You may consider taking Linear Algebra and Probability in parallel, if you lack a systematic exposition to these topics.
  • You should know Python, or be willing to learn it fast (learning Python fast is possible).  We will spend only one class explaining the basics of Python, so if you do not know Python before taking the course, you will have to pick it up by yourself.  Python is a language with a low barrier of entry, but you are recommended to start learning it before the class begins, if you have no experience.
Intended learning outcomes

After the course, the student should be able to:

  • Identify applications of Bayesian analysis
  • Formulate Bayesian Models
  • Implement construction of Bayesian Models using a probabilistic programming framework PyMC3 in Python
  • Learn model parameters from data
  • Explain differences between sampling algorithms, select, and use an appropriate inference algorithm
  • Evaluate the models, inference, and learning queries experimentally
  • Test your probabilistic programs
Learning activities

  • About 12 lectures on probabilistic Bayesian modeling and programming. The lectures are an opportunity to reflect on the prescribed reading material and to engage in a discussion on this topic.
  • About 12 exercise session on building models and programming analyses.  The major part of the learning takes part in the exercises and the associated home works, as this is a programming skill oriented course.
  • About 12 home works: each exercise is supposed to be continued in self-study homework style after the exercises.  Group-work and individual study is permitted. 
  • Final mini-project (part of the final exam)

Course literature

John Kruschke. Doing Bayesian Data Analysis. Academic Press 2015 (2nd edition)

Supporting material: Bayesian Methods for Hackers; available at:

Student Activity Budget
Estimated distribution of learning activities for the typical student
  • Preparation for lectures and exercises: 27%
  • Lectures: 11%
  • Exercises: 31%
  • Project work, supervision included: 26%
  • Exam with preparation: 5%
Ordinary exam
Exam type:
D: Submission of written work with following oral, External (7-point scale)
Exam variation:
D1G: Submission for groups with following oral exam based on the submission. Shared responsibility for the report.

Time and date
Ordinary Exam - submission Thu, 20 May 2021, 08:00 - 14:00
Ordinary Exam Mon, 7 Jun 2021, 09:00 - 20:55
Reexam - submission Wed, 14 Jul 2021, 08:00 - 14:00
Reexam Fri, 20 Aug 2021, 09:00 - 20:55