DATASCI 447 Lecture 3: Regularization Is Bayesian

Kevin McAlister

January 20, 2026

Administrative Stuff

What We Saw Last Time

Let’s discuss:

  • How does minimizing a loss function correspond to probability distributions?

  • What is an empirical distribution? How does MLE fit to the empirical distribution?

  • What does minimizing MSE correspond to in distributional terms? Binary cross entropy?

  • For linear models fit under MSE, what happens to \(\sigma^2\) as model complexity increases under MSE?

  • Why does MLE create pressure toward overfitting?

What We Saw Last Time

What is overfitting from a probabilistic perspective?

  • Really important!

Under Pressure

Under Pressure

Maximizing the log-likelihood introduces a pressure on the model.

  • Since all we see is the empirical distribution, our goal is to place as much mass as possible at the observed locations

  • Respecting the assumed conditional distribution structure and the constraint that the mean of the distribution follows the mean function

For regression - \(f_{\theta}(\mathbf x) = \mathbf x^T \boldsymbol \beta\)

Under Pressure

Under Pressure

The Key Problem

MLE methods solve a problem:

\[ \underset{\theta}{\max} \sum \limits_{i = 1}^N P(y_i | \mathbf x_i , \theta) \]

  • Find the conditional distributions defined by our hypothesis class that minimize the KL divergence to the empirical distribution

If the hypothesis class allows arbitrarily concentrated densities, the likelihood has no reason to stop decreasing!

The Key Problem

Collapse is not bad behavior. It is the optimizer doing its job

  • If I give a dog a whole bag of food at once, I shouldn’t be mad if it eats it all!

  • The minimization algorithm is just minimizing the function to the best of its ability by placing as much mass as possible at the observed data points.

Quick note:

  • In Gaussian models, this manifests as \(\sigma^2\) shrinking to 0

  • This is not a pathology of Gaussian - it is generic to likelihood based estimation!

  • What will happen in logistic regression if we give it infinite capacity?

The Key Problem

Question 1: Why do we even think that this is a bad thing?

Some reasons:

  • We have a finite sample size

  • Most mechanisms that map features to outcomes are not infinitely complicated

  • In the face of competing models with similar performance, choose the one that is simplest

All completely viable rationale.

The Key Problem

The big one:

  • We have some beliefs about the way that world works.

  • We know that what we see is just a sample and may not be indicative of the true empirical distribution due to lack of coverage

But where do those beliefs come into play?

  • When we choose function classes

  • Regularization penalties

  • Etc.

Zero Beliefs Imply Degenerate Solutions

Central claim:

If we truly had zero beliefs about how the world works, the degenerate MLE solution is correct.

This is not a criticism of MLE.

This is a statement about what happens when we impose no structure.

Let’s make this formal using Bayesian inference.

Bayesian Inference

Bayes’ rule for parameters given data:

\[ p(\theta | \mathcal D) = \frac{p(\mathcal D | \theta) p(\theta)}{p(\mathcal D)} \]

Components:

  • \(p(\mathcal D | \theta)\): Likelihood - probability of data given parameters
  • \(p(\theta)\): Prior - beliefs about \(\theta\) before seeing data
  • \(p(\theta | \mathcal D)\): Posterior - beliefs about \(\theta\) after seeing data
  • \(p(\mathcal D)\): Evidence - normalizing constant (marginal likelihood/model evidence). We’re going to avoid this today, but it is going to be a central quantity next lecture!

Bayesian Inference

The posterior:

\(p(\theta | \mathcal D)\)

is a proper probability density function

  • Defines a distribution over the values of the unknowns conditioned on the data we observed

  • Mean, variance, covariance, etc.

Sometimes, we only care about the most likely value of the unknowns conditioned on the data

Bayesian Inference

The Maximum A Posteriori (MAP) estimate is defined as:

\[ \hat{\theta} = \max_{\theta} P(\mathcal D | \theta) P(\theta) \]

  • Drop the normalizing constant because we’re maximizing w.r.t. \(\theta\) and it doesn’t have anything to do with it

  • Think of this like a Bayesian MLE…

The Flat Prior

Suppose we use a flat (improper) prior:

\[ p(\theta) \propto 1 \quad \text{(constant everywhere)} \]

Maximum A Posteriori (MAP) estimation:

\[ \hat \theta_{\text{MAP}} = \underset{\theta}{\max} p(\theta | \mathcal D) = \underset{\theta}{\max} p(\mathcal D | \theta) p(\theta) \]

With \(p(\theta) \propto 1\):

\[ \hat \theta_{\text{MAP}} = \underset{\theta}{\max} \; p(\mathcal D | \theta) = \hat \theta_{\text{MLE}} \]

Exactly!

Interpretation: MLE is Bayesian inference under total epistemic neutrality.

What Does a Flat Prior Mean?

\(p(\theta) \propto 1\) says:

  • All parameter values are equally plausible a priori
  • No preference for simple vs complex models
  • No structural assumptions about the problem
  • No domain knowledge encoded
  • Complete ignorance about \(\theta\)

This represents maximal epistemic neutrality.

Question: Is this realistic?

Collapse is Rational Under Zero Information

If we truly have no beliefs about \(\theta\):

  • Posterior \(\propto\) Likelihood
  • MAP = MLE
  • Mass collapse is the correct Bayesian inference

Mass collapse reflects rational updating under complete epistemic neutrality.

The data are the only information we have.

The MLE solution is what probability theory prescribes when data are our only guide.

The Philosophical Punch

Objecting to overfitting is objecting to agnosticism.

The moment you want generalization, you are asserting structure that is not in the data.

Examples of structural assumptions:

  • “Simpler models are more plausible”
  • “Parameters should be small in magnitude”
  • “Most coefficients are probably zero”
  • “The function should be smooth”
  • “Extreme parameter values are unlikely”

These are beliefs, not observations.

  • Bayesian inference is a necessity, not a preference.

Bayesian Inference as Constrained Probability Geometry

We’ve established that we need priors to avoid collapse.

Now: How do priors work mechanically?

Key insight: Bayesian inference is regularized optimization with probabilistic semantics.

Let’s make this precise.

Bayes’ Rule (Structural Form)

Start from Bayes’ rule:

\[ p(\theta | \mathcal D) = \frac{p(\mathcal D | \theta) p(\theta)}{p(\mathcal D)} \]

Take logarithms:

\[ \log p(\theta | \mathcal D) = \log p(\mathcal D | \theta) + \log p(\theta) - \log p(\mathcal D) \]

Since \(p(\mathcal D)\) doesn’t depend on \(\theta\):

\[ \log p(\theta | \mathcal D) = \log p(\mathcal D | \theta) + \log p(\theta) + \text{const} \]

The Negative Log Posterior

Multiply by \(-1\):

\[ -\log p(\theta | \mathcal D) = -\log p(\mathcal D | \theta) - \log p(\theta) + \text{const} \]

Define two terms precisely:

\[ \mathcal{L}_N(\theta) = -\log p(\mathcal D | \theta) = -\sum_{i=1}^N \log p(y_i | \mathbf x_i, \theta) \]

\[ \mathcal{R}(\theta) = -\log p(\theta) \]

Then:

\[ -\log p(\theta | \mathcal D) = \mathcal{L}_N(\theta) + \mathcal{R}(\theta) + \text{const} \]

Posterior Energy Decomposition

\[ -\log p(\theta | \mathcal D) = \underbrace{\mathcal{L}_N(\theta)}_{\text{Data/Likelihood}} + \underbrace{\mathcal{R}(\theta)}_{\text{Regularization/Prior}} + \text{const} \]

Data term \(\mathcal{L}_N(\theta)\):

  • Negative log-likelihood
  • Measures how well model explains observed data
  • Smaller when model fits data well

Regularization term \(\mathcal{R}(\theta)\):

  • Negative log-prior
  • Measures complexity/implausibility of \(\theta\)
  • Smaller when \(\theta\) aligns with prior beliefs

Geometric Interpretation

Geometric Interpretation

Geometric Interpretation

What the Prior Encodes

The prior \(p(\theta)\) encodes structural beliefs:

  • Magnitude: Expected size of parameters
  • Sparsity: How many parameters should be nonzero
  • Smoothness: Relationships between neighboring parameters
  • Constraints: Hard boundaries (e.g., \(\theta > 0\))
  • Correlations: Dependencies between parameters
  • Domain knowledge: Problem-specific structure

Different priors \(\Rightarrow\) different regularizers \(\Rightarrow\) different solutions

The Critical Identity

Regularization is not “added later.”

It is literally the negative log-prior.

\[ \mathcal{R}(\theta) = -\log p(\theta) \]

This means:

  • Every regularizer implies a prior distribution
  • Every prior distribution implies a regularizer
  • They are equivalent ways of expressing the same structural assumption

Sample Size Changes Everything

So far, we’ve established:

  • Likelihood pushes toward mass collapse
  • Prior pushes toward structure
  • Posterior balances the two

But which force wins?

The Scaling Question

Recall the negative log posterior:

\[ -\log p(\theta \mid \mathcal D) = \mathcal{L}_N(\theta) + \mathcal{R}(\theta) + \text{const} \]

where

\[ \mathcal{L}_N(\theta) = -\sum_{i=1}^N \log p(y_i \mid \mathbf x_i, \theta) \]

\[ \mathcal{R}(\theta) = -\log p(\theta) \]

How Do These Terms Scale?

Key observation:

  • The likelihood term \(\mathcal{L}_N(\theta)\) grows with sample size
  • The prior term \(\mathcal{R}(\theta)\) does not

This asymmetry is the entire story.

Likelihood Scaling

Each observation contributes a term:

\[ -\log p(y_i \mid \mathbf x_i, \theta) \]

So the total likelihood penalty is:

\[ \mathcal{L}_N(\theta) = \sum_{i=1}^N \ell_i(\theta) \]

This means:

\[ \mathcal{L}_N(\theta) = O(N) \]

Prior Scaling

The prior is specified once:

\[ p(\theta) \]

Its contribution to the objective is:

\[ \mathcal{R}(\theta) = -\log p(\theta) \]

This does not depend on \(N\).

\[ \mathcal{R}(\theta) = O(1) \]

The Asymmetry

Putting this together:

\[ \mathcal{L}_N(\theta) = O(N), \quad \mathcal{R}(\theta) = O(1) \]

As \(N\) grows, the likelihood term dominates the posterior geometry.

Consequence for MAP

Recall MAP estimation:

\[ \hat\theta_{\text{MAP}} = \min_\theta \big[ \mathcal{L}_N(\theta) + \mathcal{R}(\theta) \big] \]

As \(N \to \infty\):

\[ \frac{1}{N}\mathcal{R}(\theta) \to 0 \]

MAP Converges to MLE

Under standard regularity conditions:

\[ \hat\theta_{\text{MAP}} \;\longrightarrow\; \hat\theta_{\text{MLE}} \]

Priors disappear asymptotically.

Interpretation

  • Priors matter most when data are scarce
  • Priors matter least when data are abundant
  • Sample size determines which force wins

Sample size is the ultimate regularizer.

Finite Samples Are the Real Problem

Regularization exists because:

  • \(N\) is finite
  • Data do not cover the space
  • Inverse problems are ill-posed

Without priors, inference is unstable.

High Dimensions Make This Worse

In modern ML:

  • \(N\) may be large
  • \(P\) may be larger
  • Effective sample size per parameter is small (e.g. curse of dimensionality)

This is why regularization does not “go away” in practice.

  • Even when we have millions of samples, we’re still going to rely on regularization via priors to assist in finding structured models!

A Concrete Example

Random values, \(x_i\), that we believe are generated from a normal distribution with variance 1

  • Goal: Learn the mean of the normal distribution using the data

Belief: The mean of the distribution is 2.

  • Somewhat strong belief that we’ll represent with a normal distribution centered on 2 with a variance of .5

A Concrete Example

Real Priors for ML

This is great and all, but most of the time we aren’t placing priors on the values of parameters in our models because we have beliefs as to what they are

  • A lot of the time our models don’t even explicitly have coefficients (think tree methods and KNN)

  • But the lessons about priors still hold here

So what gives?

Instead of placing priors on the values of the coefficients, themselves, we want to place priors on the types of functions that can be learned

  • Functions not too wiggly, but can be wiggly is \(N\) is big

  • Functions of a fixed order should have a minimal coefficient budget

  • Etc.

Real Priors for ML

In practice, there are two common strategies for regularizing function spaces:

  • Truncating the hypothesis class

  • Placing structural priors on parameters to encourage nice solution types

Truncating the Hypothesis Class

One way to regularize is to remove functions from consideration entirely.

Instead of saying “These parameters are unlikely,”

We say “These functions are impossible.”

Formally:

  • Define a hypothesis class \(\mathcal{H}\)
  • Restrict \(\mathcal{H}\) to a subset \(\mathcal{H}_{\text{allowed}}\)
  • Assign probability zero to all functions outside this set

\[ p(f) = 0 \quad \text{for } f \notin \mathcal{H}_{\text{allowed}} \]

This is a hard prior on function space.

Truncation in Practice

Many standard ML methods are function-class truncation in disguise.

  • Polynomial regression
    • Limiting degree to \(d\) restricts curvature and oscillation
    • A degree-9 polynomial is not allowed if \(d=3\)
  • Decision trees
    • Maximum depth limits hierarchical complexity
    • Pruning removes entire regions of function space
  • k-Nearest Neighbors
    • Large \(k\) forbids highly local, spiky functions
    • Small \(k\) allows more irregular functions

These are priors on what kinds of functions can exist, not on coefficient values.

Structural Priors on Function Space

In practice, we often write models in linear form:

\[ f_\theta(\mathbf x) = \mathbf x^\top \boldsymbol\beta \]

But this does not mean we believe the world is linear.

It means:

  • We are choosing a basis for representing functions
  • And we believe there is structure in how those basis elements combine

The prior is where that belief lives.

What We Actually Believe

Given limited data, we often believe:

  • Large coefficients are unlikely
  • Extreme cancellations are fragile
  • Many reasonable explanations are near the origin
  • Simpler functions should be preferred unless data demand otherwise

These are beliefs about functions, expressed through parameters.

Independent Normal Priors

A common structural assumption:

\[ \beta_j \sim \mathcal N(0, \tau^2) \quad \text{independently} \]

This prior says:

  • No coefficient is a priori special
  • Large magnitudes are unlikely
  • The function is built from many small contributions

This induces a prior geometry on the space of admissible functions.

Probabilistic Geometry of the Prior

Probabilistic Geometry of the Prior

Quick identity: the prior predictive distribution

\[ P(y | \mathbf x) = \int \limits_{\theta} P(y | \mathbf x, \theta) P(\theta) d(\theta) \]

  • With respect to the prior, what is the marginal distribution of \(y\) given a vector \(\mathbf x\).

  • We can easily simulate this distribution

Probabilistic Geometry of the Prior