Introduction

This course focuses on supervised machine learning. Two areas of machine learning we do not cover involve self-supervised learning and reinforcement learning.

Setup

We use the following packages:

  1. numpy: working with \(n\)-D arrays
  2. torch: training of differentiable models
  3. torchvision: tools for vision models
  4. pandas: working with data
  5. matplotlib: plotting
  6. tqdm: progress bars in the command line
  7. scikit-learn: source some classic datasets

The following command uses pip to install these python packages:

pip install torch torchvision numpy matplotlib tqdm pandas scikit-learn

Virtual Environment

Virtual environments allow you to install a custom set of packages with custom package versions for a project.

Inside the dlcourse directory, run

python -m venv code-venv

to create a blank virtual environment.

Activate it, and then install packages. Upon activation, the command line prompt changes to start with the name of the virtual environment. Here, it would be (code-venv):

source code-venv/bin/activate
pip install torch torchvision numpy matplotlib tqdm pandas scikit-learn

When you are done, you can run deactivate to return to the default global environment.

NumPy

A nice overview of using numpy is located online here.

Two KEY issues to watch out for:

  1. Standard matrix multiplication in numpy uses the @ symbol, not the * symbol. Users coming from Matlab or Julia often trip over this issue a few times until they internalize the new symbol.
  2. 2D Arrays are stored in row-major form.