January 27, 2026
Introductory ML materials present ML as minimizing loss
Not training error - true loss
Regularization as a method that creates a tuning knob that allows models to vary between high bias/low variance to low bias/high variance and use CV methods to find the setting that best generalizes (bias/variance tradeoff)
This definition is fine, but complex models and data types don’t fit cleanly in this bucket
What is the true loss?
How do I regularize when I have 1 million tuning parameters?
What can I do when using CV is too expensive to figure it out?
Probabilistic ML allows us to begin to think about this process less as a hand-wavy mechanical one and more through the lens of probability theory and model geometry
Minimizing the negative log likelihood (NLL) is equivalent to minimizing the loss.
Regularization is a way to restrict the space of functions that can be recovered by a learning method by placing priors on the function space
To jointly find \(\mathbf M\) and \(\bbeta\) that are most generalizable over all possible models within our model class:
\[ \{\hat{\mathbf M}, \hat{\bbeta} \} = \max_{\mathbf M} \int \limits_{\btheta} P(\mathbf y | \mathbf X, \bbeta , \mathbf M) P(\bbeta | \mathbf M) d \bbeta \]
\[ \{\hat{\mathbf M}, \hat{\bbeta} \} = \max_{\mathbf M} E_{\bbeta} \left[ P(\mathbf y | \mathbf X, \bbeta , \mathbf M) \right] \]
Find the arrangement of \(\mathbf M\) and \(\bbeta\) that maximize the likelihood that we would’ve seen our observed data accounting for our prior structural constaints
Also can think of it as maximize the expected value of the likelihood taken w.r.t. \(\bbeta\)
Solving this integral is going to be critical for creating good generative models
But we’ve glossed over something fundamental:
Today: What properties should a model class have, and when do those properties actually help us?
In practice, we want learning methods that:
This isn’t just theoretical preference — it’s practical necessity
Medical Imaging: Millions of scans across diverse populations
Recommendation Systems: Billions of user-item interactions
Fraud Detection: Adversarial, non-stationary environment
Language Models: Trillions of tokens of text
Autonomous Vehicles: Safety-critical, must work across conditions
Common thread: We need methods that automatically find good solutions across diverse problems without requiring domain-specific engineering for each new task
Given this goal, what properties should our model class \(\mathcal{F}\) have?
Property 1: Should be able to capture complex, nonlinear relationships
Property 2: Should have a “complexity knob” we can tune
Property 3: Should be able to fit any reasonable target function given enough capacity
Property 3 has a name: Universal Approximation
Spoiler: Universal approximation tells us the answer is “in there somewhere”
It does not tell us we can find it with finite data
Definition: A class of functions \(\mathcal{F}\) is a universal approximator on a compact domain \(\mathcal{X} \subseteq \mathbb{R}^p\) if for any continuous function \(f^*: \mathcal{X} \to \mathbb{R}\) and any \(\epsilon > 0\), there exists \(f \in \mathcal{F}\) such that:
\[\sup_{x \in \mathcal{X}} |f(x) - f^*(x)| < \epsilon\]
In words: For any continuous target function and any desired precision, there exists a function in our class that gets uniformly close to the target everywhere on the domain.
Removing nerd speak: it can learn any function
What this definition says:
What this definition does NOT say:
\(\mathcal{F}\) is a universal approximator if it is dense in the space of continuous functions
Intuition: No matter what continuous function you pick, you can find members of \(\mathcal{F}\) arbitrarily close to it
There are no “gaps” in what \(\mathcal{F}\) can represent
A model class is a universal approximator if it admits a complexity path — a nested sequence:
\[\mathcal{F}_{\lambda_1} \subseteq \mathcal{F}_{\lambda_2} \subseteq \cdots \subseteq \mathcal{F}\]
such that:
Base case: \(\mathcal{F}_{\lambda_1}\) contains simple functions (e.g., constants)
Monotonic expressivity: Higher complexity \(\lambda\) = larger function class
Limiting completeness: \(\bigcup_\lambda \mathcal{F}_\lambda\) is dense in continuous functions
Intuition: Universal approximators come with a “knob” we can turn from simple to arbitrarily complex
For finite data \(\{(x_i, y_i)\}_{i=1}^n\) with distinct \(x_i\), a universal approximator can achieve:
\[\hat{f}(x_i) = y_i \quad \text{for all } i = 1, \ldots, n\]
That is: zero training error is always achievable with sufficient complexity
Often the most practically relevant formulation: “Can we at least fit the training data?”
What methods do you know that have this property?
| Method | Complexity Parameter | How It Achieves Universality |
|---|---|---|
| Polynomial regression | Degree \(d\) | Stone-Weierstrass theorem |
| KNN | \(1/K\) | \(K=1\) interpolates |
| Decision trees | Depth / leaves | One leaf per point |
| Kernel methods (RBF) | \(1/\lambda\) | Kernel interpolation |
| Neural networks | Width and/or depth | Cybenko (1989), Hornik (1991) |
Key Point: Universal approximation is NOT unique to neural networks!
The theorems for neural networks get all the attention, but this property is shared by many classical methods
If \(\mathcal{F}\) is a universal approximator, then the true function \(f^*\) (assuming it’s continuous) is in the closure of \(\mathcal{F}\)
What this means:
We’re not limiting ourselves by our choice of function class
The “right answer” is in there somewhere
What this doesn’t mean:
We can actually find it
With sufficient complexity, we can always fit the training data perfectly
This sounds good:
If we can’t even fit the training data, we certainly can’t generalize
But it’s also dangerous:
Interpolating noisy data means memorizing noise
Zero training error \(\neq\) zero test error
Universal approximation combined with consistency results tells us:
\[\hat{f}_n \xrightarrow{P} f^* \quad \text{as } n \to \infty\]
What this says: With infinite data, we can recover the truth
What this leaves open:
What universal approximation gives us:
With enough data and capacity, this learner could learn the true function
This is a statement about existence
What we actually face:
Given finite, noisy samples \(\{(x_i, y_i)\}_{i=1}^n\) where \(y_i = f^*(x_i) + \epsilon_i\)
Find \(\hat{f} \in \mathcal{F}\) such that \(\hat{f} \approx f^*\)
The gap: Universal approximation tells us \(f^*\) can be approximated by some \(f \in \mathcal{F}\)
It does NOT tell us:
How do we navigate a universal approximator in practice?
We use the complexity path: tune from simple to complex
The fundamental tradeoff:
\[\text{True Risk} = \underbrace{\sigma^2}_{\text{Irreducible}} + \underbrace{\text{Bias}^2}_{\text{Approximation Error}} + \underbrace{\text{Variance}}_{\text{Estimation Error}}\]
How do each of these terms change as we increase the complexity of our models?
Bias — decreases with complexity: \[\text{Bias}^2 = O\left(\lambda\right)\]
Variance — increases with complexity, decreases with sample size: \[\text{Variance} = O\left(\frac{\lambda}{N}\right)\]
How do we find the optimal complexity \(\lambda^*\) in practice?
Cross-validation estimates the true risk at each complexity level:
\[\widehat{R}_{CV}(\lambda) \approx \text{True Risk}(\lambda)\]
CV then selects:
\[\hat{\lambda}_{CV} = \arg\min_\lambda \widehat{R}_{CV}(\lambda)\]
The guarantee: With enough data and folds, CV converges to the best complexity among models on the path
This is exactly what CV is supposed to do — and it does it well!
But there’s a critical assumption hidden here:
We’re assuming the path actually passes through a good region
What if the best model on the path is still bad?
The ideal scenario: Path dips close to optimal
CV finds the minimum, and it’s close to the best possible
The problematic scenario: Entire path floats high
CV finds the minimum of the path — but that minimum is still far from good
Is it possible to know how far the path is going to float above the optimum?
Theorem (Stone, 1982): For nonparametric regression in \(\mathbb{R}^P\) with \(f^*\) having smoothness \(S\) (the number of continuous derivatives for the function):
\[ \inf_{\hat{f}} \sup_{f^* \in \mathcal{C}^s} \mathbb{E}\|\hat{f} - f^*\|^2 = \mathcal O\left(\frac{1}{N^{\frac{2S}{2S+P}}}\right) \]
What this says:
\[ \mathcal O\left(\frac{1}{N^{\frac{2S}{2S+P}}}\right) \]
Goal: Make as small as possible. What should we make big? What should we make small?
This is where dimension enters!
The effective “smoothness-to-complexity” ratio depends on:
\[\text{Optimal Rate} = O\left(N^{-\frac{2S}{2S+P}}\right)\]
As dimension \(P\) increases:
| Dimension \(p\) | Rate (with \(s=1\)) | Samples for 1% error |
|---|---|---|
| 1 | \(N^{-2/3}\) | ~\(10^{3}\) |
| 5 | \(N^{-2/7}\) | ~\(10^{5}\) |
| 10 | \(N^{-1/6}\) | ~\(10^{12}\) |
| 50 | \(N^{-1/26}\) | ~\(10^{52}\) |
| 100 | \(N^{-1/51}\) | ~\(10^{102}\) |
Same sample size, vastly different achievable error rates
Key insight: Stone’s theorem is a lower bound
This isn’t a statement about any particular method:
It says: No method can escape this rate
The curse of dimensionality is not a failure of our algorithms
It’s a fundamental property of high-dimensional learning problems
\[R(\hat{f}_{\lambda^*}) = \sigma^2 + O\left(N^{-\frac{2S}{2S+P}}\right)\]
When \(P\) is small relative to \(N\):
When \(P\) is large relative to \(N\):
A truth:
No learning algorithm can beat this rate!
But, how bad can it really be?
Loading CIFAR-10 dataset...
Dataset size: 50000 images
Image shape: 32×32×3 = 3,072 dimensions
Number of classes: 10
Dimensionality: 3,072 features (32×32×3 RGB pixels)
Training samples: 50000 images
Suppose we have \(P\) features, we can implement a degree \(d\) polynomial in \(P\) dimensions with all interactions
\[ y = \beta_0 + \beta_1 x_1 + \beta_2 x_1^2 + \beta_3 x_2 + \beta_4 x_2^2 + ... \]
Stone-Weierstrass theorem proves that the path of \(d \in (0,1,2,...,\infty)\) is a universal approximator
Even though polynomial regression has the universality property, why do you think that it is quickly going to crash and burn?
The \(P\) to \(N\) ratio is going to get out of control very quickly!
For a degree \(d\) model with \(P\) features, there will be:
\[ \frac{(P + d)!}{P!d!} \]
parameters
| Degree \(d\) | \(P = 10\) | \(P = 50\) | \(P = 100\) |
|---|---|---|---|
| 1 | 11 | 51 | 101 |
| 2 | 66 | 1,326 | 5,151 |
| 3 | 286 | 23,426 | 176,851 |
| 4 | 1,001 | 316,251 | 4,598,126 |
I didn’t run this one for CIFAR because it quickly gets computationally unruly
This presents us with the main reason that we avoid explicitly parameterized models:
Note: Kernelized methods (like SVMs) get around this issue by using implicit representations of high degree feature spaces. However, they always have \(P = N\). With reasonable \(N\), the gap between the “best” and the best will be quite large. Also, a computational nightmare!
The Setup
For a test point, \(\mathbf x_0\), compute \(y_0\) as:
The average of the \(y_i\) associated with the \(K\) nearest \(\mathbf x_i\) in the training set (continuous outcomes)
The most common \(y_i\) associated with the \(K\) nearest \(\mathbf x_i\) in the training set (categorical outcomes)
Complexity Path
Choose \(K\) that minimizes CV error.
Why do you think that KNN is going to crash and burn as \(P\) gets larger?
Beyer et al, 1999: As \(P\) gets larger
\[ \frac{\max_{i,j} \|\mathbf x_i - \mathbf x_j\|}{\min_{i,j} \|\mathbf x_i - \mathbf x_j\|} \overset{P}{\longrightarrow} 1 \]
As \(P\) increases, every point has equal distance!
Nearest neighbor means very little
KNN quickly degrades in high dimensions
Performance is quite bad
Computational nightmare too
The Setup
Recursively partition feature space with axis-aligned splits
Complexity Path
Choose depth/leaves that minimizes CV error
Why do you think that trees are going to crash and burn as \(P\) gets larger?
Axis-aligned splits are inefficient
High variance
But wait — what about Random Forests and XGBoost?
These are the workhorses of modern ML on tabular data!
Random Forests (Bagging):
Gradient Boosting (XGBoost, LightGBM):
Do these escape the curse?
How ensembles help:
Why ensembles don’t fully escape the curse:
Stone’s bound still applies — just with better constants
All these methods share the same failure mode:
They work in the ambient feature space \(\mathbb{R}^P\)
They rely on locality in that space
When \(P\) is large: Locality breaks down, and all methods struggle
Important reframe:
These methods aren’t bad — they’re doing exactly what they should!
Stone’s theorem tells us: No method working in \(\mathbb{R}^P\) can do better than \(O(N^{-2S/(2S+P)})\)
The problem isn’t the algorithms
The problem is the feature space
Instead of trying to make our learning methods better in \(\mathbb R^P\), what if we focused on reducing \(P\)?
Do you know of any methods that try to do this in a principled way?
Goal: Reduce the dimensionality of the feature space from \(P\) to \(K\) where \(K << P\).
But doesn’t that result in information loss?
Answer: It depends on whether or not the data has underlying structure
The Manifold Hypothesis: Real high-dimensional data doesn’t fill the ambient feature space!
Loading MNIST dataset...
MNIST images: 28×28 = 784 dimensions
Random images also: 784 dimensions
But only MNIST lives on a low-dimensional manifold!
The Manifold Hypothesis: Real high-dimensional data doesn’t fill the ambient feature space!
Random words \(\neq\) sentences
Thousands of frequency bins, but random combinations aren’t speech
Thousands of genes, but cells occupy limited phenotypic states
The Hypothesis:
High dimensional data lies on or near a low dimensional manifold \(\mathcal M^K\) embedded in \(\mathbb R^P\)
How do we know that this is the case for images, text, and sound?
Loading MNIST dataset...
Loading MNIST dataset...
Compression is Possible!
JPEGs reduce image size by 10-20x with minimal loss
MP3 compresses audio dramatically
If we can compress, then we can represent the object in lower dimensional spaces
Feature dependence is high
In images: the color of a nearby pixel is largely the same as its surrounding pixels (we’re smooth color collections, not chaos)
In text: word co-occurrences follow strong patterns
| Data Type | Ambient Dimension \(P\) | Estimated Intrinsic Dimension \(K\) |
|---|---|---|
| MNIST | 784 | ~10-15 |
| CIFAR-10 | 3,072 | ~20-30 |
| ImageNet | 150,528 | ~40-50 |
| Natural images (generic) | varies | ~100-200 |
| English text (word embeddings) | 50,000+ | ~100-300 |
The gap between \(P\) and \(K\) is enormous!
The methods aren’t bad…
If data lies on \(\mathcal M^K \subset \mathbb R^P\):
Working in \(K\) space instead of \(P\) space drastically reduces the gap of our best learners to the optimal solution
\[ \mathcal O\left(N^{- \frac{2s}{2s + k}}\right) \text{ vs. } \mathcal O\left(N^{- \frac{2s}{2s + P}}\right) \]
To get the interior to .1:
30 dimensions requires 32k samples (CIFAR 10 has 60k!)
3072 requires around \(10^{154}\)!!!!
One is achievable, the other is not.
We have a candidate tool for learning a data optimal mapping from \(\mathbb R^P \rightarrow \mathbb R^K\) - PCA
Finds directions of max variance
Finds the best \(K\)-dimensional linear subspace
Good if our mapping can be linear
But this isn’t usually the case…
Learnable, non-linear projections are needed (a.k.a. neural networks)