10-315, Spring 2024

Introduction to Machine Learning (SCS majors)

Overview

Key Information

Monday + Wednesday, 12:30 pm - 1:50 pm, Scaife Hall 105

Section A, Friday 10:00 am - 10:50 am, WEH 2302, see Recitation

Section B, Friday 11:00 am - 11:50 am, WEH 2302

Section C, Friday 12:00 pm - 12:50 pm, GHC 4301

Section D, Friday 01:00 pm - 01:50 pm, GHC 4102

Section E, Friday 01:00 pm - 01:50 pm, WEH 4625

Section F, Friday 03:00 pm - 03:50 pm, WEH 2302

Vincent Tombari Shreeya Khurana, Alex Xu, Deep Patel, Ruthie Lin, Medha Palavalli, Myles Harris, Tanay Bennur, Anisha Chatterjee, Ethan Wang, see the 315 Staff page

Grades will be collected in Canvas.
Midterm 1 20%, Midterm 2 20%, Written/Programming Homework 40%, Pre-Lecture Reading Checkpoints 5%, Online Homework 5%, Participation 5%, Mini-project 5%

There is no required textbook for this course. Any recommended readings will come from sources freely available online.

We will use Piazza for questions and any course announcements.

Students will turn in their homework electronically using Gradescope.

Machine Learning is concerned with computer programs that automatically improve their performance through experience (e.g., programs that learn to recognize human faces, recommend music and movies, and drive autonomous robots). This course covers the core concepts, theory, algorithms and applications of machine learning.

Learning Objectives

After completing the course, students should be able to:

  • Select and apply an appropriate supervised learning algorithm for classification and regression problems (e.g., linear regression, logistic regression, ridge regression, nonparametric kernel regression, neural networks, naive Bayes, support vector machines).
  • Recognize different types of unsupervised learning problems, and select and apply appropriate algorithms (e.g., k-means clustering, Gaussian mixture models, linear and nonlinear dimensionality reduction).
  • Work with probability (Bayes rule, conditioning, expectations, independence), linear algebra (vector and matrix operations, eigenvectors, SVD), and calculus (gradients, Jacobians) to derive machine learning methods such as linear regression, naive Bayes, and principal component analysis.
  • Understand machine learning principles such as model selection, overfitting, and underfitting, and techniques such as cross-validation and regularization.
  • Implement machine learning algorithms such as logistic regression via stochastic gradient descent, linear regression, or k-means clustering.
  • Run appropriate supervised and unsupervised learning algorithms on real and synthetic data sets and interpret the results.

Levels

This course is designed for SCS undergraduate majors. It covers many similar topics to other introductory machine learning course, such as 10-301/10-601 and 10-701. This 10-315 course and 15-281 AI Representation and Problem Solving are designed to complement each other and provide both breadth and depth across AI and ML topics. Contact the instructor if you are concerned about which machine learning course is appropriate for you.

Prerequisites

The prequisites for this course are:

  • 15-122: Principles of Imperative Computation
  • 36-225 or 36-218 or 36-217 or 15-259 or 15-359 or 21-325 or 36-219: Probability
  • 15-151 or 21-127 or 21-128: Mathematical Foundations of Computer Science / Concepts of Mathematics.
  • 21-241 or 21-240 or 21-242: Linear Algebra

While not explicitly a prerequisite, we will be programming exclusively in Python. Please see the instructor if you are unsure whether your background is suitable for the course.

Office Hours

OHQueue: Link

Pat's Office Hours

Pat would very much like to help you all as much as possible. In addition to standing office hourse, he often have "OH" (or "Open") appointment slots on his office hours appointment calendar. If no there are no available OH or appointments that meet your needs, please contact Pat via a private post on Piazza with a list of times that work for you to meet.

Schedule

Subject to change

Textbooks:

Bishop, Christopher. Pattern Recognition and Machine Learning, available online

Daumé III, Hal. A Course in Machine Learning, available online

(DL) Goodfellow, Ian, Yoshua Bengio, Aaron Courville. Deep Learning, available online

(MML) Marc Peter Deisenroth, A. Aldo Faisal, and Cheng Soon Ong. Mathematics for Machine Learning, available online

Mitchell, Tom. Machine Learning, available online

Murphy, Kevin P. Machine Learning: A Probabilistic Perspective, available online

(KMPA) Shaw-Taylor, John, Nello Cristianini. Kernel Methods for Pattern Analysis, available online

Dates Topic Lecture Materials Pre-Reading Reading (optional)
1/15 Mon No class: MLK Day
1/17 Wed 1. Introduction Notation_Guide.pdf
Math_Background.pdf
pptx (inked) pdf (inked)
MML 2.1-3, 2.5, 2.6 and 3.1, 3.2.1, 3.3
1/22 Mon 2. ML Problem Formulation pptx (inked) pdf (inked) Mitchell 1.1-1.2
Daumé 1
1/24 Wed 3. Decision Trees pptx (inked) pdf (inked) Daumé 2, Entropy, Cross-Entropy video, A. Géron
Paper: ID3
1/29 Mon 4. K-Nearest Neighbor and Model Selection pptx (inked) pdf (inked) Pre-reading: Opt and LinReg.pdf
Checkpoint due 1/28 Sun, 11:59 pm
Daumé 3
MML 8.3.3
1/31 Wed 5. Optimization and Linear Regression pptx (inked) pdf (inked)

regression interactive.ipynb
regression blind interactive.ipynb
MML 8.2-8.2.2, 8.2.4
MML 5.2-5.5
2/5 Mon 6. Optimization and Linear Regression (cont.) See previous lecture slides
Pre-reading: FeatEng and LogReg.pdf
Checkpoint due 2/6 Tue, 11:59 pm
2/7 Wed 7. Feature Engineering
Logistic Regression
pptx (inked) pdf (inked) Bishop 4.1.3, 4.3.2, 4.3.4
2/12 Mon 8. Logistic Regression (cont.) pptx (inked) pdf (inked)

Demos:
Pre-reading: Neural Networks.pdf
Checkpoint due 2/11 Sun, 11:59 pm
2/14 Wed 9. Neural Networks pptx (inked) pdf (inked)
three neuron interactive.ipynb
MML 5.6
DL 6
The Matrix Cookbook
2/19 Mon 10. Neural Networks (cont.) pptx (inked) pdf (inked)
Universal network Desmos
Perceptron neuron Desmos
2/21 Wed 11. Regularization pptx (inked) pdf (inked)

regression regularization.ipynb
Regularization interpolation Desmos (3D)
L1_sparsity.ipynb
Pre-reading: MLE.pdf
Checkpoint due 2/20 Tue, 11:59 pm
DL 7.1,7.8
Bishop 3.1.4
2/26 Mon 12. MLE and Probabilistic Modeling pptx (inked) pdf (inked)
MML 9-9.2.2
Bishop 1.2.4-5, 3.1.1-2
2/28 Wed EXAM 1
In-class
Learning objectives: pdf
Practice exam: pdf (sol)
3/4 Mon No class: Spring Break
3/6 Wed No class: Spring Break
3/11 Mon 13. MAP pptx (inked) pdf (inked)

Desmos: Bernoulli Likelihood and Posterior
Pre-reading: MAP.pdf
Checkpoint due 3/11 Mon, 10:00 am
MML 9.2.3-4
Mitchell MLE and MAP
3/13 Wed 14. Neural Net Applications - PyTorch Intro and ML Model Cards pptx (inked) pdf (inked)

Demo: autoencoder csv.ipynb
PyTorch Basics Tutorial
Model Cards For Model Reporting. Margaret Mitchell, et al (2019)
3/18 Mon 15. Neural Net Applications - Images pptx (inked) pdf (inked)

Demos:
No pre-reading this week DL 9
3/20 Wed 16. Neural Net Applications - Images (cont.) See previous lecture slides
3/25 Mon 17. Neural Net Applications - Language Desmos: Cosine Similarity
The Illustrated {Word2vecAttentionTransformerGPT-2}. Jay Alammar
Video (and code): Let's build GPT. Andrej Karpathy
3/27 Wed 18. Neural Net Applications - Language (cont.)
4/1 Mon 19. Probabilistic Generative Models and Naive Bayes discriminant analysis.ipynb Pre-reading: Probabilistic Generative Models.pdf
Checkpoint due 4/1 Mon, 11:00 am
Mitchell Generative and Discriminative Classifiers
Murphy 3.5, 4.2, 8.6
4/3 Wed 20. Generative Models (cont.) Pre-reading: PCA.pdf
Checkpoint due 4/3 Wed, 11:00 am
4/8 Mon 21. Dimensionality Reduction: PCA, Autoencoders, Feature Learning Demos: Pre-reading: Recommender Systems and Clustering.pdf
Checkpoint due 4/7 Sun, 11:59 pm
PCA: Bishop 12.1, Murphy 12.2
4/10 Wed 22. Dimensionality Reduction (cont.)
Clustering, K-means
K-means: Bishop 9.1, Murphy 25.5
4/15 Mon 23. Recommender Systems
Gaussian Mixture Models, EM Algorithm
Matrix Factorization Techniques for Recommender Systems (pdf). Koren, Bell, and Volinsky (2009)
GMM/EM: Bishop 9.2
4/17 Wed 24. Nonparametric Regression, Kernels Demos: Pre-reading: Kernel Regression.pdf
Checkpoint (optional) due 4/17 Wed, 11:00 am
KMPA 7.3, 7.3.2
4/22 Mon 25. Learning Theory A Few Useful Things to Know about Machine Learning. Pedro Domingos (2012).
Generalization Abilities: Sample Complexity Results. Nina Balcan (2015). Lecture notes.
4/24 Wed EXAM 2
In-class
Learning objectives: pdf
Practice problems: pdf (solutions)

Recitation

Recitation starts the first week of class, Friday, Jan. 19th. Recitation attendance is recommended to help solidify weekly course topics. That being said, the recitation materials published below are required content and are in scope for midterms 1 and 2. Students frequently say that recitations are one of the most important aspects of the course.

Recitation section assignments will be locked down after the third week. Until then, you may try attending different recitation sections to find the best fit for you. In the case of any over-crowded recitation sections, priority goes to students that are officially registered for that section in SIO. The process to select your final recitation assignment will be announced on Piazza as we get closer to Recitation 4.

Recitations will be on Fridays in the following individual recitation sections:


Section Time Location TAs Resources
A Friday 10:00 am - 10:50 am WEH 2302 Ruthie and Vincent
B Friday 11:00 am - 11:50 am WEH 2302 Medha and Deep
C Friday 12:00 pm - 12:50 pm GHC 4301 Shreeya and Ethan
D Friday 01:00 pm - 01:50 pm GHC 4102 Vincent and Myles
E Friday 01:00 pm - 01:50 pm WEH 4625 Ruthie and Tanay
F Friday 03:00 pm - 03:50 pm WEH 2302 Alex and Anisha


Dates Recitation Handout/Code
1/19 Fri Recitation 1: NumPy hello_notebooks.ipynb
visualizing_data_1.ipynb (solution)
visualizing_data_2.ipynb (solution)
visualizing_data_3.ipynb (solution)
indexing_trick.ipynb (solution)
messing_with_mnist.ipynb (solution)
Reference: NumPy_Tutorial_from_11-785.ipynb
1/26 Fri Recitation 2: Decision Trees and K-NN Worksheet: pdf (solution)
kNN.ipynb
DT.ipynb
2/2 Fri Recitation 3: Matrix Calculus and Linear Regression pdf (solution)
2/9 Fri Recitation 4: Logistic Regression pdf (solution)
2/16 Fri Recitation 5: Neural Networks pdf (solution)
2/22 Fri Recitation 6: Regularization, Prob/Stat/MLE pdf (solution)
3/1 Fri No recitation
3/8 Fri No recitation
3/15 Fri Recitation 7: PyTorch, MAP Worksheet: pdf (solution)
PyTorch Overview Slides
PyTorch Tutorial Notebook.ipynb
3/22 Fri Recitation 8: Neural Net Applications Worksheet: pdf (solution)
Desmos: Cosine Similarity
word_embeddings.ipynb (solution)
face_linear_manual.ipynb (solution)
3/29 Fri Recitation 9: Neural Net Applications, Naive Bayes Worksheet: pdf (solution)
word_embeddings_2.ipynb (solution)
minGPT_pico.ipynb
minGPT_femto.ipynb
4/5 Fri Recitation 10: Generative & Discriminative Models, Naive Bayes with Laplace Smoothing Worksheet: pdf (solution)
discriminant analysis.ipynb
4/12 Fri Recitation 11: PCA, Recommender Systems, K-means (no in-person recitation) pdf (solution)
4/19 Fri Recitation 12: GMM, Regression pdf (solution)
4/26 Fri Recitation 13: Last Recitation! Mini-project Help Session

Exams

The course includes two midterm exams. The midterms will be 12:30-1:50 pm on Feb. 28 and Apr. 24. Both will take place in class. Plan any travel around exams, as exams cannot be rescheduled.

Mini-project

A mini-project due during the final exam period. This will be an opportunity to work with a team and apply machine learning concepts from class to a project that is more customized to your interests. More details about the mini-project details and deadlines will be announce later in the semester.

Assignments

There will be approximately five homework assignments that will have written and programming components and approximately six online assignments (subject to change). Written and online components will involve working through algorithms presented in the class, deriving and proving mathematical results, and critically analyzing material presented in class. Programming assignments will involve writing code in Python to implement various algorithms.

For any assignments that aren't released yet, the dates below are tentative and subject to change.

Assignment due dates (Tentative)

Assignment Link (if released) Due Date
HW 0 (online) Gradescope 1/25 Thu, 11:59 pm
HW 1 (programming) hw1.ipynb 1/25 Thu, 11:59 pm
HW 2 (online) Gradescope 2/1 Thu, 11:59 pm
HW 3 (written/programming) hw3_blank.pdf, hw3_tex.zip, hw3.ipynb 2/8 Thu, 11:59 pm
HW 4 (online) Gradescope 2/15 Thu, 11:59 pm
HW 5 (written/programming) hw5_blank.pdf, hw5_tex.zip, hw5.ipynb 2/22 Thu, 11:59 pm
HW 6 (online) Gradescope 3/21 Thu, 11:59 pm
HW 7 (written/programming) hw7_blank.pdf, hw7_tex.zip, hw7.ipynb 3/28 Thu, 11:59 pm
HW 8 (online) Gradescope 4/4 Thu, 11:59 pm
HW 9 (online) Gradescope 4/18 Wed, 11:59 pm
HW 10 (written/programming) hw10_blank.pdf, hw10_tex.zip, hw10.ipynb 4/18 Thu, 11:59 pm

Policies

Grading

Grades will ultimately be collected and reported in Canvas.

Final scores will be composed of:

  • 20% Midterm Exam 1
  • 20% Midterm Exam 2
  • 40% Written/Programming homework
  • 5% Online homework
  • 5% Participation
  • 5% Pre-Lecture Reading Checkpoints
  • 5% Mini-project

Final Grade

This class is not curved. However, we convert final course scores to letter grades based on grade boundaries that are determined at the end of the semester. What follows is a rough guide to how course grades will be established, not a precise formula — we will fine-tune cutoffs and other details as we see fit after the end of the course. This is meant to help you set expectations and take action if your trajectory in the class does not take you to the grade you are hoping for. So, here's a rough heuristics about the correlation between final grades and total scores:

  • A: above 90%
  • B: 80-90%
  • C: 70-80%
  • D: 60-70%

This heuristic assumes that the makeup of a student's grade is not wildly anomalous: exceptionally low overall scores on exams, programming assignments, or written assignments will be treated on a case-by-case basis.

Precise grade cutoffs will not be discussed at any point during or after the semester. For students very close to grade boundaries, instructors may, at their discretion, consider participation in lecture and recitation, exam performance, and overall grade trends when assigning the final grade.

Participation

In class, we will use a series of polls as part of an active learning technique called Peer Instruction. Your participation grade will be based on the percentage of these in-class poll questions answered:

  • 0% for 50% or less
  • 5% for 80% or greater poll participation
  • Linear scale for values in between 50% and 80%
  • Correctness of in-class polling responses will not be taken into account for participation grades.
  • If a poll is duplicated with the same question (e.g. before and after discussing with your neighbor), you should answer all of the duplicated versions as well, as they will be counted as separate polls.
  • If you have systemic/repeated technical issues, please let us know as soon as possible, so we can resolve the situation.
  • Missing polls due to absences (e.g., brief illness) from lecture or due to technical difficulties is expected occasionally, and this is why you only need to answer >= 80% of the polls to get full credit.

It is against the course academic integrity policy to answer in-class polls when you are not present in lecture. Violations of this policy will be reported as an academic integrity violation. Information about academic integrity at CMU may be found at https://www.cmu.edu/academic-integrity.

Late Policies, and Extensions, and Exceptions

Participation

  • Missing polls due to absences (e.g., brief illness) from lecture or due to technical difficulties is expected occasionally, and this is why you only need to answer >= 80% of the polls to get full credit.
  • If you must miss many lectures due to circumstances outside of your control (e.g., if you have an extended illness) please e-mail Joshmin, joshminr@andrew.cmu.edu, prior to lecture.

Pre-reading checkpoints

Pre-reading checkpoints don't have any extensions or late days. However, the lowest two checkpoints will be dropped when computing your semester score. Reasoning: We want to make sure that everyone is able to complete the pre-reading prior to lecture, so we can build on that knowledge in class; minor illness and other minor disruptive events outside of your control happen occasionally and thus dropping the lowest two scores. See below for information on rare exceptions.

Written/programming homework and online homework

You have a pool of 6 slip days across all written/programming and online assignment types

  • Use up to two per assignment
  • Written and programming assignments with the same homework number are considered the same assignment; so e.g., if you turn in both programming and written components within 24 hours after the due date, you will use one slip day, not two.
  • You may use these at your discretion, but they are intended for minor illness and other disruptive events outside of your control, and not for poor time management.
  • No need to inform us that you are using a slip day; just submit it to Gradescope during the slip day.
  • You are responsible to keep track of your own slip days. Gradescope will not enforce the total number of slip days
  • Homework submitted after these two slip days or submitted by a student without any slip days remaining will be given a score of 0.

Exceptions and extensions

Aside from slip days, dropping the lowest checkpoints, and the 80% threshold for participation, there will be no extensions on assignments in general. If you think you really really need an extension on a particular assignment, e-mail Joshmin, joshminr@andrew.cmu.edu, as soon as possible and before the deadline. Please be aware that extensions are entirely discretionary and will be granted only in exceptional circumstances outside of your control (e.g., due to severe illness or major personal/family emergencies, but not for competitions, club-related events, or interviews). The instructors will require confirmation from your academic advisor, as appropriate.

We certainly understand that unfortunate things happen in life. However, not all unfortunate circumstances are valid reasons for an extension. Nearly all situations that make you run late on an assignment homework can be avoided with proper planning - often just starting early. Here are some examples:

  • I have so many deadlines this week: you know your deadlines ahead of time - plan accordingly.
  • It's a minute before the deadline and the network is down: you always have multiple submissions - it's not a good idea to wait for the deadline for your first submission.
  • My computer crashed and I lost everything: Use Google Drive, Dropbox, or similar system to do real-time backup - recover your files and finish your homework from a cluster machine or borrowed computer.

Collaboration and Academic Integrity Policies

Collaboration

  • The purpose of student collaboration is to facilitate learning, not to circumvent it. Studying the material in groups is strongly encouraged. You are also allowed to seek help from other students in understanding the material needed to solve a particular homework problem, provided any written notes (including code) are taken on an impermanent surface (e.g. whiteboard, chalkboard), and provided learning is facilitated, not circumvented. The actual solution must be done by each student alone.
  • A good method to follow when collaborating is to meet with your peers, discuss ideas at a high level, but do not copy down any notes from each other or from a white board. Any scratch work done at this time should be your own only. Before writing the assignment solutions, you should make sure that you are doing this without anyone else present, putting all notes away, closing all tabs on your computer, and writing it completely by yourself with no other resources.
  • You may NOT view, share, or communicate about any artifact that will be submitted as part of an assignment. Example artifacts include, but are not limited to: code, pseudocode, diagrams, and text.
  • You may look at another student's code output and discuss it at a conceptual level, as long as it is not output that appears directly in the homework submission.
  • You may look at another student's code error messages and discuss what the error means at a conceptual level. However, you may NOT give specific instructions to fix the error.
  • All work that you present must be your own. Auto-generated code, for example, is not acceptable.
  • Using any external sources of code or algorithms in any way must have approval from the instructor before submitting the work. For example, you must get instructor approval before using an algorithm you found online for implementing a optmization function in a programming assignment.
  • The presence or absence of any form of help or collaboration, whether given or received, must be explicitly stated and disclosed in full by all involved. Specifically, each assignment solution must include answering the following questions:
    1. Did you receive any help whatsoever from anyone in solving this assignment? Yes / No.
      • If you answered ‘yes’, give full details: ____________
      • (e.g. “Jane Doe explained to me what is asked in Question 3.4”)
    2. Did you give any help whatsoever to anyone in solving this assignment? Yes / No.
      • If you answered ‘yes’, give full details: _____________
      • (e.g. “I pointed Full Name to section 2.3 since they didn’t know how to proceed with Question 2”)
    3. Did you find or come across code that implements any part of this assignment ? Yes / No. (See below policy on “found code”)
      • If you answered ‘yes’, give full details: _____________
      • (book & page, URL & location within the page, etc.).
  • If you gave help after turning in your own assignment and/or after answering the questions above, you must update your answers before the assignment’s deadline, if necessary by emailing Joshmin.
  • Collaboration without full disclosure will be handled severely, in compliance with CMU’s Policy on Academic Integrity.

AI Assistance

To best support your own learning, you should complete all graded assignments in this course yourself, without any use of generative artificial intelligence (AI), such as ChatGPT. Please refrain from using AI tools to generate any content (text, video, audio, images, code, etc.) for an assessment. Passing off any AI generated content as your own (e.g., cutting and pasting content into written assignments, or paraphrasing AI content) constitutes a violation of CMU’s academic integrity policy.

Policy Regarding “Found Code”

You are encouraged to read books and other instructional materials, both online and offline, to help you understand the concepts and algorithms taught in class. These materials may contain example code or pseudo code, which may help you better understand an algorithm or an implementation detail. However, when you implement your own solution to an assignment, you must put all materials aside, and write your code completely on your own, starting “from scratch”. Specifically, you may not use any code you found or came across. If you find or come across code that implements any part of your assignment, you must disclose this fact in your collaboration statement.

Duty to Protect One’s Work

Students are responsible for pro-actively protecting their work from copying and misuse by other students. If a student’s work is copied by another student, the original author is also considered to be at fault and in gross violation of the course policies. It does not matter whether the author allowed the work to be copied or was merely negligent in preventing it from being copied. When overlapping work is submitted by different students, both students will be punished.

Do not post your solutions publicly, neither during the course nor afterwards.

Penalties for Violations of Course Policies

Violations of these policies will be reported as an academic integrity violation and will also result in a -100% score on the associated assignment/exam. Information about academic integrity at CMU may be found at https://www.cmu.edu/academic-integrity. Please contact the instructor if you ever have any questions regarding academic integrity or these collaboration policies.

(The above policies are adapted from 10-601 Fall 2018 and 10-301/601 Fall 2023 course policies.)

Accommodations for Students with Disabilities

If you have a disability and have an accommodations letter from the Disability Resources office, we encourage you to discuss your accommodations and needs with us as early in the semester as possible. We will work with you to ensure that accommodations are provided as appropriate. If you suspect that you may have a disability and would benefit from accommodations but are not yet registered with the Office of Disability Resources, we encourage you to visit their website.

Statement of Support for Students’ Health & Well-being

Take care of yourself. Do your best to maintain a healthy lifestyle this semester by eating well, exercising, getting enough sleep, and taking some time to relax. This will help you achieve your goals and cope with stress.
All of us benefit from support during times of struggle. There are many helpful resources available on campus and an important part of the college experience is learning how to ask for help. Asking for support sooner rather than later is almost always helpful.
If you or anyone you know experiences any academic stress, difficult life events, or feelings like anxiety or depression, we strongly encourage you to seek support. Counseling and Psychological Services (CaPS) is here to help: call 412-268-2922 and visit their website at http://www.cmu.edu/counseling/. Consider reaching out to a friend, faculty or family member you trust for help getting connected to the support that can help.
If you have questions about this or your coursework, please let us know. Thank you, and have a great semester.