# Machine Learning and Data Mining

## Overview

Machine learning is a set of techniques that allow machines to learn from data and experience, rather than requiring humans to specify the desired behavior by hand. Over the past two decades, machine learning techniques have become increasingly central both in AI as an academic field, and in the technology industry. This course provides a broad introduction to some of the most commonly used ML algorithms. It also serves to introduce key algorithmic principles which will serve as a foundation for more advanced courses, such as CSC412/2506 (Probabilistic Learning and Reasoning) and CSC421/2516 (Neural Networks and Deep Learning).

The first half of the course focuses on supervised learning. We begin with nearest neighbours, decision trees, and ensembles. Then we introduce parametric models, including linear regression, logistic and softmax regression, and neural networks. We then move on to unsupervised learning, focusing in particular on probabilistic models, but also principal components analysis and K-means. Finally, we cover the basics of reinforcement learning.

### Policies (marking, prerequisites, etc.)

See the course information handout.

### Where and When

There are four sections of the course. Since all sections are fully subscribed, please attend the one you are registered for.

Starting Monday, 11/19, all tutorials will be held in the main lecture room for the corresponding section.

 Section 1 Section 2 Section 3 Section 4 Instructor: Amir-massoud Farahmand Juan Carrasquilla Roger Grosse Roger Grosse Lecture Time: Monday 11-1 Wednesday 11-1 Thursday 4-6 Friday 11-1 Lecture Room: BA 1170 BA 1160 BA 1170 SF 1101 Tutorial Time: Monday 3-4 Wednesday 3-4 Thursday 6-7 Friday 3-4 Tutorial Room(by first letter of last name) A-N: BA 1170 O-Z: BA 2195 A-N: BA 1160 O-Z: BA 2175 A-N: BA 1170 O-Z: BA 2145 A-N: SF 1101 O-Z: BA 2155

### Teaching Staff

• Instructors: Roger Grosse, Amir-massoud Farahmand, and Juan Carrasquilla
• Office hours:
• Juan: Mondays 12-1pm in BA 2283
• Amir-massoud: Mondays 1-2pm in BA 2283
• Roger: Mondays 5-7pm in PT 290F
• TA office hours will be announced for each homework assignment.
• TAs: Aryan Arbabi, Jesse Bettencourt, Elliot Creager, Chris Cremer, Mohammad Firouzi, Jonathan Lorraine, David Madras, Bret Nestor, Punit Shah, and Guodong Zhang
• Staff e-mails:
• TAs and instructor: csc411.f18.staff [at] gmail.com
• Instructors and head TA only: csc411.f18.instructors [at] cs.toronto.edu
• We will use Piazza for the course forum. If your question is about the course material and doesn't give away any hints for the homework, please post to Piazza so that the entire class can benefit from the answer.

## Homeworks

Most weekly homeworks will be due on Wednesdays at 11:59pm. Please see the course information handout for detailed policies (marking, lateness, etc.).

 Out Due Materials TA Office Hours Homework 1 9/19 9/26 [Handout] [clean_real.txt] [clean_fake.txt] [clean_script.py] Fri 9/21, 4-5pm, in BA3289 Tues 9/25, 6-7pm, in PT290C Wed 9/26, 2-3pm, in BA2283 Homework 2 9/27 10/3 [Handout] Fri 9/28, 4-5pm, in BA3289 Tues 10/2, 6-7pm, in BA3201 Wed 10/3, 2-3pm, in BA2283 Homework 3 10/4 10/10 10/12 [Handout] [Starter Code] Fri 10/5, 4-5pm, in BA3289 Tues 10/9, 6-7pm, in BA3201 Wed 10/10, 2-3pm, in BA2283 Thurs 10/11, 2-3pm, in BA3201 Fri 10/12, 4-5pm, in BA3289 Homework 4 10/20 10/31 11/2 [Handout] Wed 10/24, 2-3pm, in BA2283 Thurs 10/25, 2-3pm, in BA3201 Fri 10/26, 4-5pm, in BA3289 Tues 10/30, 6-7pm, in BA3201 Wed 10/31, 2-3pm, in BA2283 Thurs 11/1, 2-3pm, in BA3201 Fri 11/2, 4-5pm, in BA3289 Homework 5 11/1 11/14 [Handout] [q1.py] [hw5digits.zip] [data.py] Thurs 11/8, 2-3pm, in BA3201 Fri 11/9, 4-5pm, in BA3289 Tues 11/13, 6-7pm, in BA3201 Wed 11/14, 2-3pm, in BA2283 Homework 6 11/15 11/21 [Handout] [Code and Data] Thurs 11/15, 2-3pm, in BA3201 Fri 11/16, 4-5pm, in BA3289 Tues 11/20, 6-7pm, in BA3201 Wed 11/21, 2-3pm, in BA2283 Homework 7 11/22 11/28 12/5 [Handout] Tues 11/27, 6-7pm, in BA3201 Wed 11/28, 2-3pm, in BA2283 Thurs 11/29, 2-3pm, in BA3201 Fri 11/30, 4-5pm, in BA3289 Tues 12/4, 6-7pm, in BA3201 Wed 12/5, 2-3pm, in BA2283 Homework 8 11/29 12/5 not marked [Handout] [Code Solution] N/A

## Tests

The course will have a midterm and a final exam. Everybody is required to take both, including graduate students.

The midterm will be held from 6-7pm on Friday, October 19.

• If you are taking the test at the main time, then you are assigned to one of the following rooms based on the first letter of your last name. Pay attention to which room you're assigned, since we're up against the capacity limit in all of these rooms.
• A-C: GB404
• D-J: GB405
• K-N: BA1130
• O-R: HA401
• S-X: HA403
• Y-Z: HA410
• The alternative time is 8-9pm on Thursday, October 18, in EX310. Because we scheduled this time based on all of the conflicts you reported, we assume all of you can make either the standard time or the alternate time.
• Because the alternate room has limited capacity, you must notify us (by e-mailing the staff mailing list) if you need to use the alternative time.
• The test will cover Lectures 1 through 9. You are not responsible for concepts introduced only in readings, tutorials, etc. However, we are likely to ask harder questions on things you've had the opportunity to practice in the homeworks.
• You may find it helpful to practice with past years' midterms (but note that they may cover a slightly different set of topics):
• TA office hours:
• Tues, 10/16, 6-7pm, in BA3201
• Wed, 10/17, 2-3pm, in BA2283
• Thurs, 10/18, 2-3pm, in BA3201
• Fri, 10/19, 4-5pm, in BA3289
• Questions: main version, alternate version, and Solutions

The final exam time will be from 7-10pm on Tuesday, December 11.

• Room locations:
• csc411, last name A-SE: BN 2N
• csc411, last name SH-Z: BN 2S
• csc2515, all students: BN 3
• BN = Clara Benson Building, 320 Huron St.
• Practice exams:

## Lectures

Here is a tentative schedule, which will likely change as the course goes on. Each "Lecture" corresponds to 50 minutes, so each 2-hour lecture session will cover 2 of them.

Suggested readings are just that: resources we recommend to help you understand the course material. They are not required, i.e. you are only responsible for the material covered in lecture.

ESL = The Elements of Statistical Learning, by Hastie, Tibshirani, and Friedman.
MacKay = Information Theory, Inference, and Learning Algorithms, by David MacKay.
Barber = Bayesian Reasoning and Machine Learning, by David Barber.
Bishop = Pattern Recognition and Machine Learning, by Chris Bishop.
Sutton and Barto = Reinforcement Learning: An Introduction, by Sutton and Barto.

 Topic Dates Slides Suggested Readings Lecture 1 Introduction 9/6, 9/7, 9/10, 9/12 [Slides] ESL: Chapter 1 Domingos, 2012. A few useful things to know about machine learning. (Skim it now and come back to it later in the course.) Lecture 2 Nearest Neighbours 9/6, 9/7, 9/10, 9/12 [Slides] ESL: 2.1-2.3, and 2.5 Metacademy: K nearest neighbors Lecture 3 Decision Trees 9/13, 9/14, 9/17, 9/19 [Slides] ESL: 9.2 Metacademy: decision trees, entropy, mutual information Lecture 4 Ensembles I 9/13, 9/14, 9/17, 9/19 [Slides] ESL: 2.9, 8.7, 15 Metacademy: bias/variance decomposition, bagging, random forests Lecture 5 Ensembles II 9/20, 9/21, 9/24, 9/26 [Slides] ESL: 10.1 Metacademy: AdaBoost Lecture 6 Linear Regression 9/20, 9/21, 9/24, 9/26 [Slides] ESL: 2.3, 3.1-3.2.1 csc321 notes Metacademy: linear regression, closed-form solution, gradient descent, ridge regression Lecture 7 Linear Classification I 9/27, 9/28, 10/1, 10/3 [Slides] csc321 notes Lecture 8 Linear Classification II 9/27, 9/28, 10/1, 10/3 [Slides] csc321 notes Lecture 9 SVMs and Boosting 10/4, 10/5, 10/8, 10/10 [Slides] Note: lecture will be videotaped because of Thanksgiving Lecture 10 Neural Networks I 10/4, 10/5, 10/8, 10/10 [Slides] Notes: part 1, part 2 Note: lecture will be videotaped because of Thanksgiving Lecture 11 Neural Networks II 10/11, 10/12, 10/15, 10/17 [Slides] Notes: part 1, part 2 Lecture 12 Principal Components Analysis 10/11, 10/12, 10/15, 10/17 [Slides] ESL: 14.5.1 Lecture 13 Probabilistic Models I 10/18, 10/19, 10/22, 10/24 [Slides] notes MacKay, Chapter 23 Lecture 14 Probabilistic Models II 10/18, 10/19, 10/22, 10/24 [Slides] MacKay, Chapters 21, 24 Lecture 15 K-Means 10/25, 10/26, 10/29, 10/31 [Slides] MacKay: Chapter 20 Bishop: 9.1 Lecture 16 Expectation-Maximization I 10/25, 10/26, 10/29, 10/31 [Slides] notes Barber: 20.1-20.3 Bishop: 9.2-9.4 Lecture 17 Expectation-Maximization II 11/1, 11/2, 11/12, 11/14 [see L16] Lecture 18 Matrix Factorizations 11/1, 11/2, 11/12, 11/14 [Slides] Lecture 19 Bayesian Linear Regression 11/15, 11/16, 11/19, 11/21 [Slides] Bishop: 3.3 Lecture 20 Gaussian Processes 11/15, 11/16, 11/19, 11/21 [Slides] Bishop: 6.1-6.2, 6.4.1-6.4.3 Lecture 21 Reinforcement Learning I 11/22, 11/23, 11/26, 11/28 [Slides] Sutton and Barto: 3, 4.1, 4.4, 6.1-6.5 Lecture 22 Reinforcement Learning II 11/22, 11/23, 11/26, 11/28 see L21 Lecture 23 Algorithmic Fairness 11/29, 11/30, 12/3, 12/5 [Slides] TBA Lecture 24 Closing Thoughts 11/29, 11/30, 12/3, 12/5 [Slides] TBA

## Tutorials

Here is a tentative tutorial schedule. Details may change as the course goes on.
 Dates Topic Materials Tutorial 1 9/6, 9/7, 9/10, 9/12 probability review [Slides] Tutorial 2 9/13, 9/14, 9/17, 9/19 linear algebra review: matrix multiplication, linear systems NumPy basics [Linear algebra slides] [NumPy presentation] [NumPy exercises] Tutorial 3 9/20, 9/21, 9/24, 9/26 gradient descent [Slides] [Lecture ipynb] [Worksheet ipynb] Tutorial 4 9/27, 9/28, 10/1, 10/3 linear algebra review: projection, eigenvalues, SVD [Slides] [NumPy presentation] [NumPy exercises] 10/4, 10/5, 10/8, 10/10 No tutorial (Thanksgiving) Tutorial 5 10/11, 10/12, 10/15, 10/17 midterm review [Slides] 10/18, 10/19, 10/22, 10/24 No tutorial Tutorial 6 10/25, 10/26, 10/29, 10/31 Markov chain Monte Carlo [Slides] [ipynb] Tutorial 7 11/1, 11/2, 11/12, 11/14 learning and inference with multivariate Gaussians [Slides] Tutorial 8 11/15, 11/16, 11/19, 11/21 Bayesian Optimization [Slides] [ipynb 1] [ipynb 2] Tutorial 9 11/22, 11/23, 11/26, 11/28 reinforcement learning [Slides] [ipynb] Tutorial 10 11/29, 11/30, 12/3, 12/5 final exam review [Slides]

## Final Project

Graduate students have the option of doing a final project in place of the homeworks for the second half of the term (i.e. Homework 5 and after). The project proposal is due on October 26, and the final project report is due on December 12 18. Students must work in groups of 2 or 3. Here are the project guidelines.

5% of your total mark is allocated to reading a set of classic machine learning papers. We hope these papers are both interesting and understandable given what you learn in this course. The 5 points are allocated on an honor system; at the end of the term, you'll check a box to indicate that you've done the readings. You don't need to hand anything in, and the readings will not be tested on the exam.
1. P. Viola and M. Jones. Rapid object detection using a boosted cascade of simple features. CVPR 2001. [pdf]
2. A. Krizhevsky, I. Sutskever, and G. E. Hinton. ImageNet classification with deep convolutional neural networks. NIPS 2012. [pdf]
3. R. Salakhutdinov and A. Mnih. Probabilistic matrix factorization. NIPS 2007. [pdf]
4. B. A. Olshausen and D. J. Field. Sparse coding with an overcomplete basis set: a strategy employed by V1? Vision Research, 1997. [pdf]
5. V. Mnih et al. Human-level control through deep reinforcement learning. Nature, 2015. [article]
6. M. Hardt, E. Price, and N. Srebro. Equality of opportunity in supervised learning. NIPS 2016. [short version] [long version (optional)]

## Computing Resources

For the homework assignments, we will use Python, and libraries such as NumPy, SciPy, and scikit-learn. We will use Python 3. You have two options:
1. The easiest option is probably to install everything yourself on your own machine.

1. If you don't already have python 3, install it.

We recommend some version of Anaconda (Miniconda, a nice lightweight conda, is probably your best bet). You can also install python directly if you know how.

2. Optionally, create a virtual environment for this class and step into it. If you have a conda distribution run the following commands:

    conda create --name csc411
source activate csc411
3. Use pip to install the required packages

    pip install scipy numpy autograd matplotlib jupyter sklearn
2. All the required packages are already installed on the Teaching Labs machines.