Hoeffding’s Inequality
The central challenge in learning theory is that we can measure only the training (empirical) error, while we ultimately care about the true (out-of-sample) error. Hoeffding’s inequality provides the mathematical guarantee that these two quantities are close with high probability.
Pointwise Error
For a fixed hypothesis , define the error on a single example as:
where:
- is the true target function.
- is the learned hypothesis.
Since is drawn randomly from the unknown distribution ,
is a Bernoulli random variable, taking only two values:
- → misclassification
- → correct classification
True (Out-of-Sample) Error
The true error is the expected value of the pointwise error:
Since the error is Bernoulli,
Interpretation: The true error is simply the probability that the hypothesis misclassifies a randomly drawn example from the data distribution.
Empirical (Training) Error
Suppose we observe an i.i.d. training set:
Define the error for each sample:
Each is a Bernoulli random variable:
The empirical error is the sample mean:
- is a random variable.
- is a fixed quantity (for a fixed hypothesis and distribution).
Hoeffding’s inequality states:
where:
- = number of training examples
- = allowable estimation error
Hoeffding bounds the probability that the empirical error differs from the true error by more than
Equivalently,
Thus, with high probability,
Although is unknown, Hoeffding guarantees it is close to the observable quantity . The true error E(h) is likely to be somewhere inside a small interval around the training error .
Maximum Likelihood Estimation (MLE) and Loss Functions
We assume a model:
where:
- = model structure
- = parameters that need to be learned
Example:
Here:
The learning problem is:
Find the parameters that best explain the observed data.
Instead of assuming the model gives the exact output, we assume the model gives a probability distribution.
The model predicts:
Probability vs Likelihood
-
Probability Viewpoint
Parameters are fixed, data changes:
If I know the parameters, how likely is this data? Example: A coin has then the Probability of is
-
Likelihood viewpoint
Data is fixed, parameters change:
Which parameter value makes my observed data most likely? Likelihood treats the parameters as the unknown quantity we want to estimate.
Maximum Likelihood Estimation (MLE)
MLE chooses the parameters that maximize the likelihood of observing the training data.
Select the parameter values that make the observed data most probable.
Given training data:
The model predicts:
The likelihood of the complete dataset is:
MLE finds:
Multiplying many probabilities creates very small numbers. Taking the logarithm converts multiplication into addition:
Because logarithm is a monotonic function, Maximizing likelihood is equivalent to maximizing log-likelihood.
In Machine learning we minimize the negative log-likelihood:
(Negative Log-Likelihood (NLL))
Loss functions are negative log-likelihoods derived from assumed probability distributions.
Loss functions are negative log-likelihoods under assumed data distributions.
The choice of a loss function is not arbitrary. Different losses arise naturally from maximum likelihood estimation (MLE) under different assumptions about how the data is generated.
The general principle is:
Given model parameters , MLE chooses:
Because products of probabilities are difficult to optimize, we usually maximize the log-likelihood, or equivalently minimize the negative log-likelihood (NLL):
The resulting loss function depends on the assumed probability distribution.
Gaussian Noise Mean Squared Error (MSE)
Assume a regression model:
where the noise follows a Gaussian distribution:
Therefore:
The likelihood is:
Taking the negative logarithm:
The constant and variance term do not affect the optimum, so minimizing NLL is equivalent to minimizing:
Therefore:
Used in:
- Linear regression
- Neural network regression
Bernoulli Distribution Binary Cross-Entropy
For binary classification:
The model predicts:
The Bernoulli likelihood is:
Taking the negative log:
This is exactly the binary cross-entropy loss:
Therefore:
Used in:
- Logistic regression
- Binary neural network classifiers
Categorical Distribution Multiclass Cross-Entropy
For multiple classes:
The model predicts:
The categorical likelihood produces:
This is categorical cross-entropy.
Therefore:
Used in:
- Image classification
- Language models
- Multiclass neural networks
PAC Learning 0–1 Loss
PAC learning focuses on generalization rather than directly optimizing probabilities.
The loss is:
The true error is:
which is:
This directly measures the probability of classification error.
The 0–1 loss is discontinuous:
- Correct prediction loss
- Incorrect prediction loss
Small changes in parameters usually do not change the loss.
Therefore:
- gradient is zero almost everywhere
- gradient is undefined at the decision boundary Gradient descent cannot effectively optimize it.
| Learning Problem | Probabilistic Assumption | Loss From MLE |
|---|---|---|
| Regression | Gaussian noise | MSE |
| Binary classification | Bernoulli distribution | Binary Cross-Entropy |
| Multiclass classification | Categorical distribution | Cross-Entropy |
| PAC theory | No noise assumption required | 0–1 loss |