Machine Learning Exercises
This repository contains the exercises accompanying the theory from my machine learning book.
The programming exercises are written in Python. If you're unfamiliar with Python, please have a look at this tutorial before working on the exercises, which also includes some notes on how to install Python and Jupyter Notebook on your own computer (please make sure you're using Python 3 and all libraries listed in the requirements.txt file are installed and up to date; you can verify this with the test_installation.ipynb notebook).
If you have a Google account, you can also run the code in the cloud using Google Colab:
While Google Colab already includes most packages that we need, should you require an additional library (e.g., skorch for training PyTorch neural networks in notebook 5), you can install a package by executing !pip install package in a notebook cell. With Colab, it is also possible to run code on a GPU, but this has to be manually selected.
If you have any questions, please send me an email.
Have fun!
Course Overview
For an optimal learning experience, the chapters from the machine learning book should be interleaved with quizzes and programming exercises as shown below. Additionally, you should take notes in the worksheet while working through the materials.
Important: Please take note of all questions that arise while working on the materials (e.g., both in the worksheet, as well as the different notebooks, you'll be prompted to answer several questions; if the answer to any of them is still unclear after reading the respective sections of the book, please include them in this list). At the beginning of each group session we'll collect all questions that you still have and discuss them.
You can also find the course syllabus on the last page of the course description, which explicitly lists all the sections of the book for each block.
Part 1: Getting started: What is ML?
Block 1.1:
- Read the whole chapter: "Introduction"
- Answer Quiz 1
Block 1.2:
- Read the whole chapter: "ML with Python"
- Install Python on your computer and complete the Python tutorial (if you haven't done this already)
Block 1.3:
- Read the whole chapter: "Data & Preprocessing"
- Answer Quiz 2
Block 1.4:
- Read the whole chapter "ML Solutions: Overview"
- Answer Quiz 3
Part 2: Your first algorithms
Block 2.1:
- Read the whole chapter: "Unsupervised Learning"
- Work through Notebook 1: visualize text (after the section on dimensionality reduction)
- Work through Notebook 2: image quantization (after the section on clustering)
Block 2.2:
- Read the first sections of the chapter "Supervised Learning" up to and including "Model Evaluation"
- Answer Quiz 4
Part 3: Advanced models
Block 3.1:
- Read the remaining sections from the supervised learning chapter, i.e., "Linear Models" up to and including "Kernel Methods"
- In parallel, work through the respective sections of Notebook 3: supervised comparison
Block 3.2:
- Start with the chapter "Deep Learning & more" up to and including the section: "Information Retrieval (Similarity Search)" and refresh your memory on the sections on TF-IDF feature vectors and cosine similarity
- Work through Notebook 4: information retrieval
Block 3.3:
- Read the section: "Deep Learning (Neural Networks)"
- Work through Notebook 5: MNIST with torch (recommended) or MNIST with keras (in case others in your organization are already working with TensorFlow)
Block 3.4:
- Read the sections: "Time Series Forecasting" and "Recommender Systems (Pairwise Data)"
Part 4: Avoiding common pitfalls
Block 4.1:
- Read the whole chapter: "Avoiding Common Pitfalls"
Block 4.2:
- Work through Notebook 6: analyze toy dataset
- Have a look at the cheat sheet, which includes a summary of the most important steps when developing a machine learning solution, incl. code snippets
Block 4.3:
- Case Study! Notebook 7: predicting hard drive failures (plan at least 5 hours for this!)
Part 5: RL & Conclusion
Block 5.1:
- Read the whole chapter: "Reinforcement Learning"
- Work through Notebook 8: RL gridmove
Block 5.2:
- Answer Quiz 5
- Read the whole chapter: "Conclusion"
- Complete the exercise: "Your next ML Project"