This is a repository for tutorial on Probabilistic Graphical Models (PGMs) of Probabilistic Modelling and Reasoning (2023/2024) - a University of Edinburgh master's course.
The tutorial notebook with exercises is in Heckerman car start model.ipynb and uses a Python package for (discrete) probabilistic graphical modelling, pgmpy.
Heckerman car start model with solutions.ipynb contains the solutions to the exercises, but we recommend first attempting to solve the exercises on your own.
Perhaps the easiest way to run the demo is to use Google Colab, which is outlined below. Alternatively, you can use conda on your local machine to set up the Python environment and run the Jupyter notebook locally (see below).
You can run the notebook on Google Colab directly via this link http://colab.research.google.com/github/vsimkus/pmr2024-pgm-demo.
More details on running notebooks from github on Google Colab can be found at https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb#scrollTo=WzIRIt9d2huC.
Alternatively you can setup the environment locally with conda. You will need to open terminal on your machine and then follow the below instructions
- Install git (linux, macOS, windows) to access the repository if you don't have it already
- Clone the git repository on your machine by running
git clone
in the terminal (you can find a guide here) - Once you've cloned the repository, step into the directory by entering
cd pmr2024-pgm-demo
into the terminal - If you don’t already have it also install miniconda (linux, macOS, windows), which will allow you to manage all python dependencies per project
- You can now create the
pmr
conda environment by typingconda env create -f environment.yml
. This step may take a while to complete since it has to download large binaries and you should better be connected to a good internet connection.
Once you have the environment prepared you can start your jupyter notebook
- Activate the conda environment with
conda activate pmr
- Now you will be able to start your jupyter server by typing
jupyter notebook
, which will start the server and open a browser to access the tutorial notebook. Click tutorial link in the browser window. You can stop the server by pressing Ctrl+c (or Cmd+c) in the terminal when you are done with it.
The course is taught by Michael Gutmann and Chris Williams, and this tutorial was created by Vaidotas Šimkus.