January 13, 2026
This is a class that is going to provide an overview of the statistical methods that underpin a number of more advanced machine learning techniques
Class flow:
Part 1: Machine Learning as Distributional Matching, The Manifold Theorem
Part 2: Neural Networks and Deep Learning as Representation Algorithms
Part 3: Generative Machine Learning (or making cool pictures of dogs and putting hats on celebrities)
For this class, I am expecting that students have taken a class on:
Linear regression (Like DATASCI 220)
Machine Learning (like DATASCI 347)
Calculus 1-3
Linear algebra
I don’t expect you to remember everything from these classes, but I do expect that when you see certain concepts they aren’t completely foreign.
We’re going to meet here on Tuesdays and Thursdays from 2:30 PM - 3:45 PM
There is no formal attendance requirement for this course, but you should show up
Be willing to stop me if there’s something that isn’t clear. If it’s not clear to you, then I’m sure there’s someone else in class who is also confused.
It’s a relatively small class, so I have no problem spending time re-clarifying points that may not have been well made.
I’ll have two office hours periods this semester:
Wednesdays 2:30 - 3:45
And one other time that I’ll announce next week
All office hours will occur in my office - PAIS 579
Over the course of the semester, there will be 6-7 problems sets. These will account for 50% of your final grade.
Implement and extend the materials discussed in class.
Introduce software and coding
Derivations and Proofs
Problem Sets will be where you get your applied practice
Lectures will largely center on the theory of why things work
Problem sets will relate more to the how
All problem sets should be submitted to the appropriate Canvas assignment as two files:
The raw notebook file (.qmd, .ipynb)
A rendered version of the notebook (.html or .pdf)
Each problem set will be posted in a variety of different formats, so feel free to use this as a template for your final solutions.
All problem sets in this class can be completed in groups of, at most, 3 students
Each student should turn in a copy of the solutions, but can be identical to group’s solutions.
All collaborators must be outlined at the top in the by-line
I recommend the same group each time - repeated vs. one-shot games of trust.
Since it is an upper level course, I’m creating a mechanism for getting rid of shirkers
You can complete assignments individually.
I can also assign you a group, if you’d like. Just email me and I’ll put people together who want a group.
The other 50% of your final grade will be determined by a final project
A significant project that applies methods discussed in this class
Up to you (and your group) exactly what this is
Do something interesting!
Projects that are too simple will not be accepted
No basic comparisons of methods
Really try to answer a question that’s interesting to you
Three checkpoints:
On March 26th, teams will present a single slide outlining their final project (10%)
On April 25th, teams will present project posters at QTM’s end of semester showcase (20%)
By May 5th, each student should submit a final paper about the final project. A scientific-styled paper no more than 15 pages and a nicely formatted Github codebase (10% for deliverable, 10% for Github)
The goal of this final project is to give you something to include in your portfolio as you apply for jobs or grad school
I’ll be using Python for this class.
You can technically use any language you want for this class
But, I highly recommend Python
Deep learning libraries are developed mostly with Python in mind
My setup:
Python 3.10
VSCode
Jupyter Notebooks/Quarto
My local hardware (my beefy little baby):
AMD Ryzen 5900x - 12 core/24 thread processor
NVIDIA RTX 5090 - 21,760 CUDA Cores/32GB GDDR7 VRAM
96GB DRAM
As we progress through this class, we’re going to get to methods that are computationally demanding
If you don’t have a machine with a discrete GPU, you’ll be using Google Colab
I highly recommend paying $10 a month for Colab Pro during this class
Gives access to better GPUs and priority time on them
If $10 a month presents a problem, let me know.
We’ll be using PyTorch throughout this class
Software for general purpose optimization
The dominant software for deep learning
Using nice utility functions from PyTorch Lightning
A really nice library that sits over PyTorch that organizes code
Automatically detects and uses GPUs and other accelerators when available
Please use Github Copilot/Codex/Etc.!
So many of the annoyances of coding with Python are gone when you use code LLMs
Matplotlib syntax
Documentation searches
scikit-learn nuances
Pytorch modules and training loops
If you have a Github account, get it student certified and you’ll be able to use Copilot for free
The topics I hope to cover this semester are outlined on the syllabus.
The pace is ambitious.
If we need to take more time on topics, we will adjust.
Quick note: I’m trying something new this semester and changing the lens through which I’m presenting the materials in this class to make generative machine learning a common thread
A part of this is that optimization doesn’t fit in to our lecture flow all that well
I’ve written a webpage that talks a little about matrix calculus, gradents/Hessians, optimization, gradient descent, and stochastic gradient descent
I’m hoping that it will be sufficient for you to go through this material on your own
By the beginning of week 4, I’m expecting that you’ve at least looked over this material and have a broad understanding.
Any questions?
What is a machine learning algorithm?
A common definition (Mitchell, 1997):
“A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E.”
In other words, a machine learning algorithm learns from data - the more data and the more trials, the better
We would hope that the algorithm is able to perform well at a defined task given some data
Machine learning is so popular because it can be used to address many different questions/achieve many different tasks.
Two basic supervised starting points:
Regression - given a vector of input features, \(\mathbf X\), and an outcome vector, \(\mathbf y \in \mathbb R\), output a function \(\hat{f}(\mathbf x)\) that accurately predicts the value of the outcome given \(\mathbf x\).
What are some questions we can answer with regression algorithms?
Machine learning is so popular because it can be used to address many different questions/achieve many different tasks.
Two basic supervised starting points:
Classification - given a vector of input features, \(\mathbf X\), and an outcome vector, \(\mathbf y \in (1,2,...,K)\), output a function \(\hat{f}(\mathbf x)\) that accurately predicts the class given \(\mathbf x\).
What are some questions we can answer with classification algorithms?
These two basic tasks largely describe what you’ve seen previously.
In your introductory machine learning class, the methods discussed largely centered on solving these kinds of problems.
We have a feature matrix ( \(N\) observations of \(P\) features), \(\mathbf X\)
We have an outcome vector ( \(N\) observations of the outcome), \(\mathbf y\)
Use \(\mathbf X\) and \(\mathbf y\) to learn \(\hat{f}(\mathbf x)\) that maps features to a predicted outcome.
\(f(\mathbf x) \approx y\)
How do we get from there to here?
Or here?
Or here?
Or here?
Note: This is an at home listen. Also, apologies for the language. But, this is the best AI generated music in the game right now!
Unfortunately, this toolkit will only get us so far
Our old definition of statistical learning:
Learning is finding a function \(f(\mathbf x) \approx y\)
A new view:
Learning is reverse-engineering the mechanism that created the data
Imagine a Nature Box that outputs data points
Collections of pixels in an image and the label
Words in the written English language
This box follows some distribution
\[ \{\mathbf x, y\} \sim P(X,Y) \]
which is a proper probability distribution over all things
Distribution of pixels in images of animals and the animal label
The sequence of words in a novel (1st word, 2nd word, etc.)
We don’t know \(P(X,Y)\)
But we can take samples
Pull the lever and one instance drops out!
The distributional goal:
Build a mathematical clone of the box from samples
The joint distribution \(P(X,Y)\) is the holy grail
If I knew this, I could answer any question about the data (at least up to probability)
How does pixel 1 correlate with pixel 277?
If I say “The dog is”, what is the probability that “barking” is the next word?
What is the distribution of pixels in an image that contains a cat?
The problem is that this distribution is often high dimensional and scary looking
\[ P(X,Y) = P(Y | X) \cdot P(X) \]
Path A (The Discriminative Path): We only care about \(P(Y | X)\) and we throw away \(P(X)\)
Shortcuts the problem. Perfectly fine if our end goal is predicting \(y\) given some set of input features.
Useless for simulation
Path B (The Generative Path): We model \(P(X)\) directly
Harder
Requires modeling the geometry of the data manifold
Grayscale images are just a matrix of pixel values
Each pixel is between 0 (black) and 255 (white)
Often renormalized between 0 and 1
RGB Images are three matrixes stacked on each other
CIFAR-10 Images: 32 x 32 RGB Images
\[P(y = 1 | \mathbf x) = \theta = \sigma(\mathbf w^T \mathbf x)\]
where:
\[\sigma(z) = \frac{1}{1 + \exp[-z]}\]
To finish out the simulator:
\[y \sim \text{Bernoulli}(\theta)\]
Regular ol’ logistic regression using the 3072 pixel values per image flattened in a consistent way.
Training Logistic Regression on 3072 features...
Logistic Regression Accuracy (Plane vs Frog): 0.8880
This is an example of a very good linear classifier
It can classify quite well!
Surely it can tell us what a frog actually looks like, right?
Let’s find the most “froggy” of all the frogs
We renormalized the pixel values to be between 0 and 1
Make any pixels that contribute positively to the probability a 1 and make those that contribute negatively a 0
Or translate the weight vector to RGB to get the expected frog
The expected frog:
The most froggy of all the frogs:
Neither of those look like a frog at all…
Can anyone tell me what’s going on here?
Bayes’ Theorem, baby!
\[P(\mathbf x | y = 1) = \frac{P(y = 1 | \mathbf x) P(\mathbf x)}{\int \limits_{\mathbf x} P(y = 1 | \mathbf x) P(\mathbf x) d\mathbf x}\]
If our goal is to find \(\mathbf x\) that maximizes this conditional probability:
\[\underset{\mathbf x}{\max} P(y = 1 | \mathbf x) P(\mathbf x)\]
We have 3072 pixels and we need to come up with some method to approximate the distribution that generated these pixels
For now, we’re going to take a shortcut and try to learn:
\[P(\mathbf x | y = \text{Frog})\]
directly using the CIFAR data set.
If I know this distribution and I can sample from it, then I can draw frogs to my little heart’s content.
When in doubt, use the workhorse of multidimensional statistics - The Multivariate Normal Distribution
\[f(\mathbf{x}) = \frac{1}{\sqrt{(2\pi)^k |\boldsymbol{\Sigma}|}} \exp\left(-\frac{1}{2}(\mathbf{x} - \boldsymbol{\mu})^T \boldsymbol{\Sigma}^{-1} (\mathbf{x} - \boldsymbol{\mu})\right)\]
where:
Given 1000 samples of frogs in the CIFAR dataset, we can use maximum likelihood estimation to figure out the parameters of the best MVN approximation given our empirical distribution
\[ \hat{\boldsymbol{\mu}} = \frac{1}{N} \sum_{i=1}^N \mathbf{x}_i \]
\[ \hat{\boldsymbol{\Sigma}} = \frac{1}{N} \sum_{i=1}^N (\mathbf{x}_i - \hat{\boldsymbol{\mu}})(\mathbf{x}_i - \hat{\boldsymbol{\mu}})^T \]
The distribution mode:
9 draws from our distribution:
Those don’t look like frogs at all!
This is an incredibly high dimensional problem that leads to a number of “traps”
Trap 1: Parameter Explosion and Emptiness
We have 5000 frog images
The covariance matrix is 3072 x 3072
That approximately 9.5 million values!!!!!
How can we learn that with only 5000 samples?
This is the definition of an ill posed problem
Most pixels show around zero covariance with other pixels!
The issue here is that our 3072 dimension feature space is a big empty box.
This is referred to as the curse of dimensionality
At 3,072 dimensions, 5,000 images is like dropping 5,000 grains of sand into the Pacific Ocean and trying to map the sea floor!
A truth:
As the number of samples increases, our ability to use the empirical distribution to approximate the true distribution increases
Our training data is just a collection of small spikes in an ocean of possibilities
The empirical distribution puts 1/N probability on exactly images we saw and 0 probability everywhere else!
What we saw is all there is and any slight variation is impossible…
In predictive modeling, you learned that memorizing the data (e.g. empirical risk = 0) leads to overfitting
The same is true here!
If a generative model just memorizes the training images, it creates a ‘simulator’ that can only replay the past. It can’t generate new frogs!
It has failed to generalize between the points
To fix this, we need to accept that our data points are just samples - not the whole truth
We need to smooth the distribution
A slightly less green frog is still a frog…
The act of smoothing or filling in the gaps based on assumptions is called Regularization
In regression, you added a penalty term \(\lambda \|\boldsymbol \beta\|^2\) to prefent overfitting
I want you to change your persepctive.
We injected our prior belief that most coefficients are close to zero
Compensate for the lack of data coverage
The world is smooth. The world is simple. Don’t believe the sharp spikes of the empirical distribution too much.
Explicit regularization through KL Divergence penalization is the secret sauce that makes modern generative models so good.
Let’s suppose that we had wayyyyy more images of frogs (think billions upon billions)
The MVN method would still not work due to its linearity constrain in the covariance matrix
Covariance is linear
If pixel A gets brighter, pixel B changes by a constant factor
In reality, if the frog tilts a little to the left, then the pixel dependencies are going to shift in a non-linear wave
The frog manifold:
There is a very small segment of the pixel space where all the pixels align in a way that is just right to give us a frog!
The Manifold Hypothesis
Real data doesn’t fill a high dimensional feature space like a gas
It lives on a low-dimensional “sheet” (manifold) that is twisted and curled through that space
Our goal in this course is not to fit the cloud; it is to discover the sheet!
This is a tough problem.
We need models that are flexible enough to capture curved manifolds in a natural way (Neural Networks and Deep Learning)
We need a probabilistic framework to smooth out the empty space (Bayesian Inference) and efficiently take draws from the complicated manifolds (Variational Inference)