PMR computer tutorials on HMMs (2021-2022)
This is a repository for computer tutorials of Probabilistic Modelling and Reasoning (2021/2022) - a University of Edinburgh master's course.
The tutorial consists of three parts:
- HMM basics
- HMM inference
- HMM learning (with coding exercises), this tutorial contains a few code snippets for you to fill in
- A notebook with complete code is also provided here
Before you start with the tutorials you will first need to setup the environment on your preferred machine. The tutorials will use simple examples, hence any machine will do.
Setup on your machine
You'll 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 clonein the terminal (you can find a guide here)
- Once you've cloned the repository, step into the directory by entering
cd pmr2022-hmminto 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
pmrconda environment by typing
conda 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.
Starting the Jupyter server
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.
You can also access and run the notebooks on Google Colab directly via this link http://colab.research.google.com/github/vsimkus/pmr2022-hmm. More details can be found at https://colab.research.google.com/github/googlecolab/colabtools/blob/master/notebooks/colab-github-demo.ipynb#scrollTo=WzIRIt9d2huC.
Note that the Colab notebook environment should already include all the required dependencies, however, the versions may differ, hence the results may differ slightly from the provided solutions but that should not be a problem for this tutorial.