maifeng / tutorials

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Table of Contents

  1. README
    1. How to read this README
    2. Docker
      1. Install Docker
      2. Pull MLSS docker image
      3. Run docker image with Jupyter
      4. Removing a running docker container
    3. Conda
    4. Colab
    5. Tutorials
      1. Deep Learning
      2. Optimization
      3. Variational Inference
      4. Reinforcement Learning
      5. Gaussian Processes
      6. Kernels
      7. Markov Chain Monte Carlo
      8. Approximate Bayesian Computation
      9. Speech Processing
      10. ML in Computational Biology

README

MLSS 2019 will have interactive and practical tutorials in the following subjects

  • Deep Learning
  • Optimization
  • Variational Inference
  • Reinforcement Learning
  • Gaussian Processes
  • Kernels
  • Markov Chain Monte Carlo
  • Approximate Bayesian Computation
  • Speech Processing
  • ML in Computational Biology

Since many of these tutorials require the participants to install software with sometimes complex dependencies which means the installation process will differ between platforms (e.g Linux, OSX and Windows) and to make sure the tutorials run smoothly, we have prepared ways for everyone to come prepared and reduce technical issues to minimum.

This means we will get more time for the actual content!

How to read this README

Since the tutorials differ in terms of programming languages used and how the tutorials will be run, each tutorial will get its own section where instructions on how to get started and get the environment for this tutorial up and running.

Most of the tutorials will be run from a docker image that we have created. If you want to read more about docker this can be done here.

Docker

We have created a docker image that runs a jupyter notebook with kernels for the tutorials which you will be access through localhost:8888 in your browser after you follow the guide below.

Install Docker

Follow these instruction to install docker. If you follow the guide, everything should be fine. If you still have problem, please ask in the Slack general channel or ping me (@Isak Falk) anywhere on the MLSS2019 Slack :)

  1. Install docker on your platform (Community Edition (CE), not Enterprise Edition (EE))

  2. (Linux only) Add your user to the docker group by running

    sudo usermod -a -G docker $USER
    

    in a terminal. This will enable you to run docker commands without using sudo.

  3. Make sure Docker works

    • Command line / terminal: In a terminal run docker run hello-world, this will give an output similar to this
    • Application: Make sure the Docker application is installed and that you can find the icon when you search for it (this will depend on your system)

Pull MLSS docker image

Pull the MLSS docker image to your computer, this image is located here.

Run the following in a terminal

docker pull isakfalk/mlss:latest

This will make the image available to you on your system. The image is a bit large (about 3gb compressed, 8gb uncompressed), this is normal, don't worry about it.

Run docker image with Jupyter

In order to get jupyter working, do the following from a terminal (note: this is how I do it on Linux, let me know if we need to do it another way on another platform)

  1. Run docker run --name mlss -p 8888:8888 isakfalk/mlss, this will start the image we pulled (isakfalk/mlss), name is mlss and forward port 8888 on the image to the port 8888 on our machine.
  2. You should see the following in your terminal img Copy the outlined part (you can do this using the command ctrl-shift-c in a terminal on Linux at least)
  3. In your browser of choice, do the following: paste the copied part into the browser and prefix it with localhost, like the image below img
  4. Congratulations! It should be working now. You can change the kernel to the tutorial kernel by clicking on the notebook you want to run and then go to the tab Kernel and choose Change kernel, you will be presented with the available kernels.

Removing a running docker container

When you are done with the jupyter notebook, we need to clean up the container as else it will not exit. Do the following to stop the jupyter notebook and clean up

  1. Run docker container stop mlss
  2. Run docker container rm mlss

Conda

Some tutorials do not use jupyter notebooks. In this case, make sure you have anaconda installed on your machine. Then run the following in a terminal where $TUTORIALS_DIR is the path to the git directory of the mlss2019 tutorials that you can clone from here and $ENV_NAME.yml is the name of the environment yaml file:

cd $TUTORIALS_DIR/environments/
conda env create -f $ENV_NAME.yml
conda activate $ENV_NAME

You should now be in the conda environment and can run the necessay files (e.g. python tutorial.py) successfully.

Alternatively, this could be done from the anaconda application directly.

Colab

Google Colab is like an online jupyter notebook that gives you access to some common python deep learning libraries and datasets together with a GPU. It's very good for running deep learning models which would be unfeasable on a CPU.

To run a tutorial on colab, do the following

  1. At the starting page pick UPLOAD and then upload the tutorial notebook from your computer
  2. To use a GPU, after loading the notebook into colab, pick Runtime -> Change runtime type -> Hardware Accelerator -> GPU.
  3. Run the notebook as you would normally

Tutorials

Deep Learning

See Colab. Note that the 5th notebook cannot run on Colab since it does not have the necessary libraries to display to a screen. If you want to run this, you can set up a conda environment with the necessary libraries imported in the notebook.

Optimization

See Docker, or go directly to how to run jupyter with docker if you have already installed and pulled the docker image. Note that you should pick the Julia kernel and not the mlss one.

Variational Inference

See Colab.

Reinforcement Learning

See Docker, or go directly to how to run jupyter with docker if you have already installed and pulled the docker image.

Gaussian Processes

See Docker, or go directly to how to run jupyter with docker if you have already installed and pulled the docker image.

  1. Lab1 - Sampling a GP.ipynb

    If you find that the first cell

    import numpy as np
    import matplotlib
    matplotlib.rcParams['figure.figsize'] = (14, 6)
    plt = matplotlib.pyplot
    

    doesn't work, change this cell to

    import numpy as np
    import matplotlib
    matplotlib.rcParams['figure.figsize'] = (14, 6)
    import matplotlib.pyplot as plt
    
  2. Lab2 - GPflow and GP Regression.ipynb

    See Lab1

Kernels

See Conda with $ENV_NAME.yml set to mlss_kern.yml. After activating the environment, go to $TUTORIALS_DIR/kernels/ and then run the notebook Tutorial Kernel.ipynb by running jupyter notebook Tutorial\ Kernel.ipynb.

Markov Chain Monte Carlo

See Conda with $ENV_NAME.yml set to mlss_mcmc.yml. After activating the environment, go to $TUTORIALS_DIR/betancourt/ and then run each tutorial by using

python $TUTORIAL_NAME.py

Approximate Bayesian Computation

See Docker, or go directly to how to run jupyter with docker if you have already installed and pulled the docker image.

Speech Processing

See Docker, or go directly to how to run jupyter with docker if you have already installed and pulled the docker image.

You can also run this in Colab.

ML in Computational Biology

There is no tutorial for the ML in computational biology, look at the slides instead.

About


Languages

Language:Jupyter Notebook 91.2%Language:HTML 6.2%Language:Python 1.8%Language:Julia 0.7%Language:Dockerfile 0.0%Language:Stan 0.0%