Learning from data is used in situations where we don’t have an analytic solution, but we do have data that we can use to construct an empirical solution.
An example is the Netflix Prize recommendation model which is typically described as a latent factor matrix factorization model trained on observed user–item ratings.
-
Viewer Vector (): Represents the user’s preferences.
- Example Factors: Likes comedy? Likes action? Prefers blockbusters? Likes Tom Cruise?
-
Movie Vector (): Represents the movie’s attributes.
- Example Factors: Comedy content, Action content, Blockbuster status, Is Tom Cruise in it?

The power of learning from data is that this entire process can be automated, without any need for analyzing movie content or viewer taste. To do so, the learning algorithm ‘reverse-engineers’ these factors based solely on previous ratings. It starts with random factors, then tunes these factors to make them more and more aligned with how viewers have rated movies before, until they are ultimately able to predict how viewers rate movies in general. In practice, these factors are not human-interpretable features (like “comedy” or “action”), but latent patterns automatically learned from data, and the model often includes additional bias terms to improve prediction accuracy. Latent factors are patterns that are statistically real but often incomprehensible to humans. We might call Factor #1 “Action,” but to the computer, it is just “Factor 1”.
Neural recommender systems extend matrix factorization by learning user and item embeddings and replacing the dot-product similarity with a nonlinear function (e.g., a neural network).
Components of learning A learning problem can be defined using four main components: input space, target function, dataset, and hypothesis set.
- (Input): The specific data used to make a decision (e.g., an individual customer’s financial information).
- (Input Space): The set of all possible inputs.
- (Output Space): The set of all possible outputs (e.g., {Yes, No} for credit approval).
- (Target Function): The unknown, ideal, perfect formula that maps every input to the correct output. This is what we are trying to learn.
- (Data Set): A collection of historical input-output examples, denoted as .
- (Hypothesis Set): The set of all candidate formulas the algorithm is allowed to consider (e.g., the set of all possible linear equations).
- (Final Hypothesis): The single, specific formula chosen by the learning algorithm from . The Learning Algorithm analyzes the Data Set () to select the best possible formula from the Hypothesis Set (), with the goal that
There is a target to be learned. It is unknown to us. We have a set of examples generated by the target. The learning algorithm uses these examples to look for a hypothesis that approximates the target.
The hypothesis set and learning algorithm are referred to informally as the learning model.
A Simple Learning Model : The Perceptron Model (Linear Hypothesis)
The perceptron models binary decisions by assigning weights to input features, computing a weighted sum plus bias, and classifying the result using a sign function to separate inputs into two classes (binary classification). Mathematical Formulation :
- Input Space (): A -dimensional vector . Each coordinate () represents a specific data field like salary, years in residence, or outstanding debt.
- Output Space (): A binary set .
- = Approve Credit
- = Deny Credit
- The Hypothesis (): The specific formula used to make the decision. It is defined as:
Weights (): These determine the importance and direction of each input.
Bias (): This represents the threshold.
larger bias → stricter approval boundary
smaller bias → more lenient approval boundary
The perceptron is a linear classification model that learns a hyperplane:
which separates the input space into:
- decision region
- decision region
A perceptron can operate in:
- 2D
- 3D
- 100D
- 10,000D For:
- → separating line
- → separating plane
- higher → hyperplane
Example : Image Classification
Input:
a grayscale image
Flattened into features,
Output:
"cat" vs "not cat"
Perceptron = hypothesis set
Each = one specific linear classifier
Learning algorithm = picks the best
To simplify the perceptron notation, the bias term is merged into the weight vector. The perceptron hypothesis is: Define: and extend the weight vector: Similarly, extend the input vector by adding a constant feature: with . This allows the bias term to be absorbed into the dot product: So the bias becomes just another weighted feature.
Now:
The perceptron can now be written compactly as:
By augmenting the input vector with a constant feature , the bias term becomes part of the weight vector, allowing the perceptron to be written as a single dot product.
The bias term in the perceptron can be absorbed into the weight vector by introducing an additional constant input feature, giving the compact form:
Perceptron Learning Algorithm (PLA) :
An iterative method used to learn the weight vector from data.
Assumption: Linearly Separable Data
We assume the dataset is linearly separable, meaning:
There exists a weight vector such that all training examples are classified correctly.
Start with an initial weight vector:
(or any arbitrary initialization)
At each iteration :
- Current weight vector:
- Select a misclassified example
A misclassified point satisfies:
The perceptron updates weights using:
Intuition Behind the Update
-
moves in the direction of the correct classification
-
increases alignment with correctly labeled examples
-
decreases error on the chosen misclassified point
-
If → move toward
-
If → move away from
At each step: -
only one example is corrected
-
other examples may temporarily become misclassified again
-
rotates the hyperplane slightly in a direction that fixes the current mistake without needing global optimization However:
The process continues until no misclassified examples remain
Perceptron learning primarily rotates the decision boundary by updating the weight vector , while the bias controls translation of the hyperplane.
The hyperplane is defined by: So:
- changing w → rotates the hyperplane
- changing b → shifts it
In the classic perceptron update, the dominant effect is rotation.
The multiplication by is used to unify the two misclassification cases into a single condition with the same mathematical form.
We want to check whether a point is misclassified.
The perceptron predicts using:
So:
- If → positive half-space
- If → negative half-space
Misclassification happens in two cases:
Case A: true label is +1, but prediction is negative
Case B: true label is -1, but prediction is positive
We must check two separate conditions:
- This is cumbersome for analysis and algorithm design.
We define a unified expression:
Case A: Misclassification condition: So :
Case B: Misclassification condition: So again:
Both cases collapse into a single condition:
Multiplying by :
- flips all negatively labeled points
- all +1 points remain in place
- all −1 points are mirrored across the origin
After transformation: Every correctly classified point must lie on the same side of the hyperplane
- correct classification means:
So all points are evaluated against the same rule: “positive alignment” (everything should land in the positive half-space)
This is useful for learning as this allows a single update rule instead of case-based logic: Effect:
- if → move toward
- if → move away from
The weight vector is not the hyperplane itself.
Instead:
is the normal vector to the hyperplane.
That means:
- is perpendicular (orthogonal) to the decision boundary
- determines which side is classified as positive
- the hyperplane is defined relative to

For any two points lying on the hyperplane:
Subtracting:
Thus:
is perpendicular to every direction lying within the hyperplane. The weight vector defines the orientation and positive direction of the classifier, while the hyperplane itself is the set of points orthogonal to that vector.
The Weight Vector Lies in the Positive Half-Space The hyperplane splits space into two regions: Positive half-space: Negative half-space: The hyperplane equation at
$w^T w = \|w\|^2$
$w^T w > 0$
So the weight vector (w) lies inside the positive half-space defined by the hyperplane. The vector :
- points toward the positive region
- acts as the normal vector to the hyperplane
- defines the direction of increasing score The sign of measures alignment with the weight vector:
- positive dot product → same general direction as
- negative dot product → opposite direction
Each perceptron update increases the signed margin of the misclassified point by a strictly positive amount, guaranteeing steady progress toward correct classification (correct side of the decision boundary)
To classify a point correctly, the prediction must agree with the true label. This is captured by requiring:
A point is misclassified when:
Proof:
$$$y(t)w^T(t+1)x(t) = y(t) \left[ w(t) + y(t)x(t) \right]^T x(t)y(t) \left[ w^T(t) + y(t)x^T(t) \right] x(t)y(t)w^T(t)x(t) + y(t)y(t)x^T(t)x(t)$$
- Since is either or , its square is always exactly 1.
- The term is the dot product of a vector with itself, which is equal to its squared length, . Assuming the data point is not the origin (a zero vector), this value is strictly positive ().
The score strictly increases after each update.
Geometric View of the Perceptron Problem
Each training example imposes a geometric constraint on the weight vector .
For a labeled example , correct classification requires:
This can be rewritten as a linear constraint on (Fix , treat w as variable):
The inequality:
defines a half-space in weight space (a half-space of all valid classifiers)** .
We denote it as:
So each training example restricts to lie in a convex region.
For a dataset of examples, we require:
This is:
-
The set of all perfect classifiers
-
must satisfy all constraints simultaneously
-
it must lie in the intersection of all half-spaces
-
Each is convex (a half-space is always convex)
-
The intersection of convex sets is also convex
The feasible set of solutions is a convex region in weight space
Training becomes:
find a point inside the intersection of all half-spaces
The perceptron update:
- starts with some
- moves it whenever a constraint is violated
- if w violates one constraint
- push w toward satisfying that constraint
The perceptron learning problem is equivalent to finding a point in the intersection of convex half-spaces defined by the training data.
Each training example defines a convex half-space constraint on , and learning reduces to finding a point in the intersection of all such half-spaces.
Perceptron learning is iterative navigation through intersections of convex half-spaces in parameter space, not data space.
Why the Perceptron Update Direction is ?
Consider the linear objective:
where:
- is fixed
- is the variable being optimized
We want to determine:
In which direction should we move to increase as quickly as possible?
The answer is given by the gradient.
Taking the gradient with respect to :
So:
the direction of steepest increase is exactly the vector
If the update is constrained to unit length:
then the optimal direction becomes:
which is the normalized version of .
The objective change after a small step is:
So maximizing improvement means maximizing:
Cauchy–Schwarz Inequality
We use:
If , then:
The maximum possible increase is therefore:
Equality in Cauchy–Schwarz occurs only when the vectors are collinear:
Under the unit norm constraint:
The perceptron update:
uses:
- as the optimal correction direction
- to determine whether to move toward or away from the point
Thus:
- positive examples pull toward themselves
- negative examples push away
The perceptron update follows the direction that maximally increases the classification score for the current example.
Lagrange Multipliers: Optimal Update Direction
We want to maximize the directional improvement of the objective:
- Objective: maximize
- Constraint: unit-length update
The Lagrangian says:
“Maximize the objective, BUT punish solutions that break the constraint.”
Differentiate with respect to :
Apply unit norm constraint:
Substitute :
So:
Substitute back into :
If the data is linearly separable:
- PLA is guaranteed to converge
- It will find a valid in a finite number of steps This result is known as the Perceptron Convergence Theorem.
Perceptron Convergence Theorem :
We are given a dataset where:
We assume linear separability, meaning:
There exists a vector such that:
Define:
- (after normalizing so )
So:
- = maximum data norm (The largest length (magnitude) among all training points)
- = geometric margin (minimum confidence) = (The Margin) : Represents the size of the gap between the classes. A larger gap makes it easier and faster for the line to find its place
At each mistake on :
Initialize:
We prove two inequalities: (A) Progress toward optimal direction (B) Growth of norm is controlled Combining them gives the mistake bound.
Step 1 - Consider dot product with (alignment with true solution):
So each mistake increases projection by:
By separability:
So:
So every mistake pushes **closer in direction to .
After mistakes:
Step 2 - Bound growth of
Compute norm growth:
=
Updates happen only on mistakes, for a mistake:
So:
Using :
After mistakes:
From Cauchy–Schwarz:
Assume :
Using bounds:
So:
The number of perceptron mistakes is bounded by:
Each update:
- increases alignment with by at least
- increases weight norm only by at most
So:
alignment grows faster than destructive “noise” in magnitude
This forces convergence.
- Larger margin → faster convergence
- Larger data norm → slower convergence → Larger data vectors push the weight vector around with massive, dramatic steps during an update
- Well-separated data → very few updates
If the data is linearly separable with margin , the perceptron makes at most mistakes before converging.
Even though the hypothesis space is infinite, PLA finds a correct solution using only simple local updates based on misclassified points. So convergence is guaranteed in finite steps.
The perceptron converges because its updates increase alignment with the true separator linearly while controlling norm growth sublinearly, forcing a finite bound on mistakes.
The Mathematical Guarantee : Why Exists (Maximum Margin Separator)
- (The Dataset): This is your entire collection of training data points.
- (The Normal Vector / Boundary): This vector defines the orientation of a specific separating hyperplane (the decision line).
- : This means we restrict our search only to unit vectors (vectors with a length of exactly 1). This acts as a geometric equalizer so we can calculate true, unscaled physical distances from the line to the data points.
- : This is the margin of a single, specific boundary line. It is the distance from that line to the absolute closest data point in the set.
- (Supremum): This is a mathematical term for the “least upper bound,” which practically means the maximum possible value
If your data points are linearly separable, you can draw infinitely many different lines that successfully split the positive data points from the negative ones.
- If you draw a line that sits incredibly close to a cluster of points, its is going to be very small. This is a risky boundary because a tiny bit of noise in new test data could easily cause a misclassification. If you carefully adjust the angle and position of the line so it sits perfectly in the middle of the two classes, you push it as far away from the data points as possible.
- represents the width of that widest possible street. It evaluates every single valid separating line () , measures the gap to its closest point , and picks the configuration that maximizes that gap
Let be finite, linearly separable. Once we establish that separating lines do exist, we know there are infinitely many of them. This is where the compactness of and the continuity of the margin function come into play to guarantee the existence of
The Extreme Value Theorem from calculus states that if you have a continuous function mapping onto a compact set (a space that is closed and has strict boundaries), the function must hit an absolute maximum value at some point within that space.
Margin as an objective function : Define the margin of a separator as a function: This measures:
how far the closest point is from the decision boundary
So the learning goal becomes:
where:
- = set of all valid separating weight vectors
The set has two important properties:
- Closed: boundary solutions are included
- Bounded (after normalization constraints)
So is a compact set in
The margin function is continuous in because:
- it depends on dot products
- dot products are continuous functions
Extreme Value Theorem
If a function is continuous on a compact set, it must attain both:
- a maximum
- a minimum
Since:
- is compact
- is continuous
then:
Without compactness, we could have:
- sequences of separators improving margin
- but no actual “best” solution attained
i.e. only a supremum, not a maximum
Compactness prevents this pathology.
The vector is:
- a valid separating hyperplane
- that achieves the largest possible margin
- among all infinitely many separators
So it is not just “good” — it is optimal.
Among all separating hyperplanes:
- some barely separate the data
- some separate with large safety gaps
- one achieves the maximum possible gap
The Perceptron is Lazy The stopping condition for the perceptron algorithm is it terminates the very instant it finds any weight vector that puts a positive gap between the boundary and every data point ()
The mathematical existence of is a property of the dataset itself, but finding it is not a guarantee of the perceptron algorithm.
The perceptron learning algorithm updates its weights incrementally whenever a training example is misclassified:
Because the updates depend on the current state of the weights, the final learned hyperplane depends strongly on:
- the initial weight vector
- the order in which training examples are presented
Different starting values cause:
- different update trajectories
- different sequences of mistakes
- different final separators Even on the same dataset.
The perceptron is an online algorithm:
- it processes one example at a time
- each update changes future behavior
Therefore changing example order changes the path through parameter space which changes the final solution
For linearly separable data:
- there are usually infinitely many separating hyperplanes
The perceptron does not optimize:
- maximum margin
- minimum norm
- global loss function
It only enforces:
So once it finds any valid separator, it stops.
The perceptron converges to:
the first separating hyperplane consistent with the training data and update trajectory
The perceptron is a feasibility algorithm, not an optimization algorithm.
- The basic perceptron stops adjusting the moment it finds any line that separates the data, even if it’s a terrible, close-shave line. This formula forms the mathematical foundation for Support Vector Machines, which are explicitly engineered to search for and calculate the precise that achieves this optimal .
Computational Optimization & Learning Theory
When adjusting the weight parameters to fit empirical observations, learning theory distinguishes between two primary approximation goals:
A. Interpolation (Strict Functional Matching)
The interpolation objective forces the network output function to pass exactly through every observed point within the finite training set:
- Overfitting: Forcing an exact zero-error fit on empirical training data typically causes the network to absorb localized data noise. This destabilizes the underlying decision boundary, leading to poor generalization behavior when evaluated on out-of-sample data.
In the standard Perceptron, we are performing discrete, rule-based updates driven entirely by local misclassifications. Because the feedback is strictly binary (correct vs. incorrect), there is no continuous “landscape” or smooth hill to walk down. The vector simply takes sharp, discrete jumps in direction until all errors vanish.
B. Regression (Global Objective Minimization)
The regression objective prioritizes tracking the global trend line or underlying data-generating distribution rather than forcing local convergence on noisy individual coordinates.
To systematically implement this approach, we define a continuous, differentiable global performance metric known as the Energy Function (loss or cost function):
- : Computes the localized directional error (the vertical distance) between the model’s current parametric estimate and the empirical datum. Instead of a binary “yes/no,” this function outputs a continuous scalar value. It tells the system exactly how far off the predictions are. If a prediction is slightly wrong, the error is small; if it is wildly wrong, the error is massive.
- All evaluated error parameters yield strictly non-negative values, preventing opposing localized errors from mathematically canceling each other out. The quadratic scaling heavily penalizes severe misclassifications or extreme data outliers. The quadratic term also creates a continuously differentiable curve, we can take the derivative (gradient) of the error surface
- Consolidates all isolated sample variances into a single, comprehensive global performance scalar across the entire dataset .
The overarching goal of network training is to minimize the total accumulated error across the global weight space:
When you shift to an energy function approach, you are essentially trying to navigate a massive, multi-dimensional terrain of mathematical data to find the lowest possible point (the global minimum). Instead of taking discrete jumps by adding the raw data vector , optimization algorithms use gradient descent to take small, precise steps down the slope of the error landscape
Transitioning from discrete updates to global functional minimization requires addressing several core mathematical challenges:
- Mathematical Topology: Determining the exact algebraic behavior and geometric profile of the optimization surface . When you map out every possible weight configuration () against its corresponding error score , you create a geometric landscape called an optimization surface or loss landscape.
- If the landscape is convex (shaped like a perfect, smooth bowl), optimization is mathematically straightforward. Any local minimum you find is guaranteed to be the absolute lowest point (the global minimum), meaning your gradient descent algorithm can easily slide straight down to the perfect solution.
- For modern neural networks, the landscape is non-convex—it is a highly chaotic terrain filled with random hills, deep valleys, saddle points, and thousands of deceptive local minima. If your algorithm gets stuck in a shallow local valley where the slope becomes flat (), it will freeze, mistakenly thinking it found the best solution when a much better one exists further away.
- Feasibility and Boundary Constraints: Formulating strict local or global constraints on allowable weight parameters to ensure convergence and structural stability.
- In a basic setup, you might let the computer choose any real number it wants for the weights (). This is called unconstrained optimization. However, in practical engineering, letting weights roam completely free often leads to exploding values, mathematical instability, or severe overfitting.
- To prevent this, we introduce constraints to restrict the search to a specific, safe region of the landscape known as the feasible set ().
- You might place a strict mathematical ceiling on the weights, such as enforcing that the length of the weight vector cannot exceed a certain limit () (Formulating Boundaries)
- When you introduce these strict boundaries, simple gradient descent is no longer enough because the algorithm might try to step completely out of bounds (Lagrange Multipliers and KKT Conditions are designed precisely to calculate local optima while strictly respecting equality () and inequality () boundaries)
- In discrete computer science, an algorithm might sort a list in exactly steps. In continuous optimization, you cannot count exact steps because you are dealing with real numbers drifting down infinite fractional curves. Complexity must instead be measured by proving convergence rates (e.g., linear, quadratic) based on the structural properties of the landscape, like whether the surface is strictly convex or non-convex.
Learning from Data vs Design from Specifications
While learning is based on data, this other approach does not use data. It is a ‘design’ approach based on specifications, and is often discussed alongside the learning approach in pattern recognition literature.
A classic example illustrating the difference between learning from data and design from specifications is coin recognition in vending machines.
The goal is to classify:
- pennies
- nickels
- dimes
- quarters
using:
- coin size
- coin mass
So each coin is represented as a 2D input vector:
In the learning approach:
- we collect example coins from each denomination
- each example becomes a labeled training point
- input → size and mass
- output → coin denomination
Coins of the same type form clusters in feature space.
The learning algorithm:
- observes the training data
- searches for a hypothesis
- learns decision boundaries separating the coin classes
A new coin is classified by:
- measuring size and mass
- feeding the measurement into the learned classifier
In feature space:
- each denomination forms a cluster
- the classifier partitions the space into regions
The boundaries are inferred directly from data.

In the design approach:
- we use prior knowledge instead of training data
- obtain official specifications from the U.S. Mint
- model:
- expected coin size
- expected mass
- measurement noise
- wear-and-tear variations
- relative frequency of each coin
Using this information, we construct a joint probability distribution over:
- size
- mass
- denomination
Once the probability model is known, we analytically derive the optimal classifier.
For a given measurement :
choose the denomination with the highest probability:
This minimizes classification error probability.
In the design approach:
- the problem is fully specified
- we derive the solution mathematically
- Example : Classifying numbers into primes and non-primes, Determining the time it would take a falling object to hit the ground
In the learning approach:
- the target function is unknown
- data is needed to approximate it empirically
- Example : Detecting potential fraud in credit card charges, Determining the age at which a particular medical test should be performed
The main difference between the learning approach and the design approach is the role that data plays. In the design approach, the problem is well specified and one can analytically derive f without the need to see any data. In the learning approach, the problem is much less specified, and one needs data to pin down what f is.
Types of Learning
Learning from data aims to infer an underlying process from observations. Because real-world settings vary widely, different learning paradigms have been developed.
Supervised Learning
In supervised learning, each training example includes both:
- input
- correct output
So the dataset has the form:
The learning algorithm uses these labeled examples to approximate the unknown function:
Example: Handwritten Digit Recognition
Each training sample consists of:
- input: image of a digit
- output: label in
So the dataset is:
The model learns to map images → digit labels.
Data can be presented to the learning process
-
Data sets are typically created and presented to us in their entirety at the outset of the learning process.
-
Active Learning In active learning:
- The algorithm selects inputs
- a supervisor provides the corresponding output So instead of passively receiving data, the model chooses what to learn from.
The learner can ask strategic questions:
“Which example would be most informative?”
This is similar to a game of 20 questions.
-
reduces number of labeled examples needed
-
focuses learning on informative regions of the input space
-
Online Learning In online learning:
- data arrives sequentially
- the algorithm updates after each example
Instead of seeing a full dataset, the learner processes a stream:
The model must:
- learn continuously
- update in real time
Use Cases
- streaming recommendation systems
- real-time user feedback (e.g., clicks, ratings)
- systems with memory or compute constraints
- no full dataset is required
No Free Lunch (NFL) theorem
Setup :
Consider a Boolean target function
defined over the three-dimensional Boolean input space
Since each input has three binary features, the input space contains
possible input vectors:
Suppose we are given the following training dataset consisting of five labeled examples:
| Input () | Output () |
|---|---|
| 000 | 0 |
| 001 | 1 |
| 010 | 1 |
| 011 | 0 |
| 100 | 1 |
The labels for the remaining inputs
are unknown.
Since each of these three unseen inputs can independently take either value or , there are
possible target functions that are consistent with the observed training data.
More generally, because a Boolean function on three Boolean inputs assigns one binary output to each of the eight possible inputs, the total number of Boolean target functions is
Only 8 of these 256 functions agree with the given training dataset; they differ only in how they label the three unseen inputs. The training dataset labels only 5 of the 8 possible inputs. The remaining unseen inputs are:
Since these three inputs are never observed, a target function can assign either 0 or 1 independently to each of them.

For each learning algorithm, let the learned hypothesis be .
Evaluate the performance of by determining how many of the eight candidate target functions agree with on:
- all 3 unseen inputs,
- exactly 2 unseen inputs,
- exactly 1 unseen input,
- none of the unseen inputs.
Consider a few of the following learning scenarios
(a) has only two hypotheses, one that always returns '' and one that always returns ''. The learning algorithm picks the hypothesis that matches the data set the most.
The hypothesis set is
The learning algorithm selects the hypothesis that correctly classifies the largest number of training examples.
On , the labels are , i.e., three positives and two negatives. The hypothesis that always predicts correctly classifies training examples, whereas the hypothesis that always predicts correctly classifies only . Therefore, the learning algorithm selects the constant hypothesis Comparing the prediction with all eight candidate target bit-strings: - one target agrees on all three points, - three targets agree on exactly two points, - three targets agree on exactly one point, - one target agrees on none of the points. Hence the distribution is To evaluate , compare it against every possible target function and count how many predictions agree.
| Target | Matches with |
|---|---|
| 000 | 0 |
| 001 | 1 |
| 010 | 1 |
| 011 | 2 |
| 100 | 1 |
| 101 | 2 |
| 110 | 2 |
| 111 | 3 |
This gives the distribution:
| Agreement | Number of target functions |
|---|---|
| 3 matches | 1 |
| 2 matches | 3 |
| 1 match | 3 |
| 0 matches | 1 |
or equivalently,
These are simply the binomial coefficients, corresponding to the number of target functions at each Hamming distance from the hypothesis.
(b) The same , but the learning algorithm now picks the hypothesis that matches the data set least.
The learning algorithm now deliberately chooses the constant hypothesis that fits the training data least, namely Although this prediction differs completely from part (a), the counting argument is identical. Every fixed three-bit prediction has exactly the same Hamming-distance distribution over the eight possible target bit-strings. Thus the distribution is again (c) XOR Hypothesis : (only one hypothesis which is always picked), where is defined by if the number of ‘s in is odd and if the number is even.
The hypothesis set contains only the XOR function:
Since there is only one hypothesis, it is always selected.
Evaluating XOR on the three unseen inputs: Comparing this fixed prediction with all eight candidate target functions again yields (d) contains all possible hypotheses (all Boolean functions on three variables), and the learning algorithm picks the hypothesis that agrees with all training examples, but otherwise disagrees the most with the .
The learning algorithm chooses a hypothesis that
- correctly classifies all training examples, and
- among all such hypotheses, disagrees with the XOR function as much as possible on the three unseen inputs.
Here contains all Boolean functions. The learning algorithm first requires perfect agreement with the five training examples in . Since the remaining three inputs are unconstrained, it chooses the hypothesis that disagrees with XOR as much as possible on those unseen points by flipping XOR’s outputs: Once again, this is simply another fixed three-bit prediction, so its agreement with the eight candidate target functions follows exactly the same combinatorial counting: Key fact: For any fixed prediction on these 3 points, since the 8 candidate targets range uniformly over all bit-strings, the number of targets agreeing with in exactly of the 3 positions is — independent of what actually predicts.
| Agreement with | # of targets (out of 8) |
|---|---|
| all 3 points | |
| 2 points | |
| 1 point | |
| 0 points |
It holds no matter which you pick.
| Scenario | on | Agree on 3 / 2 / 1 / 0 |
|---|---|---|
| (a) best-fit constant | ||
| (b) worst-fit constant | ||
| (c) XOR | ||
| (d) anti-XOR (perfect on ) |
Although the four learning algorithms produce different hypotheses, every fixed prediction on the three unseen inputs has exactly the same agreement distribution over the eight possible target functions. Consequently, averaging over all target functions consistent with the training data, no algorithm performs better than any other.
This illustrates the central idea behind the No Free Lunch principle: without additional assumptions about which target functions are more likely, no learning algorithm has an inherent advantage on unseen data. Any improvement in generalization must come from introducing an appropriate inductive bias, rather than from the learning algorithm alone.
Without making assumptions about the target function, no learning algorithm is inherently better than any other, even random guessing.
Any improvement over random guessing must come from introducing inductive bias (assumptions about which target functions are more likely), rather than from the learning algorithm alone.
Learning is only possible because real-world problems are not arbitrary. The No Free Lunch theorem shows that if every target function were equally likely, no algorithm could outperform any other on average. Successful machine learning therefore depends on incorporating assumptions or biases that reflect the structure of real data.
Using a probability distribution
We can indeed infer something outside using only , but in a probabilistic way.
Estimating an Unknown Probability from Sampling : Suppose a bin contains red and green marbles. The proportion of red marbles is such that
- the probability of drawing a red marble is ,
- the probability of drawing a green marble is , where is fixed but unknown.
We draw a sample of marbles with replacement, so each draw is independent. Let denote the observed fraction of red marbles in the sample.
What does the observed value of tell us about the unknown probability ?
⇒ is an estimate of the unknown parameter
For each draw, define the random variable
Since the probability of drawing a red marble is ,
Each is therefore a Bernoulli random variable.
We draw marbles.
If exactly of them are red, then the observed fraction of red marbles is
Since
we can also write
The quantity is called the sample proportion.
Using the linearity of expectation,
Since every draw has expectation ,
Therefore,
estimates . The sample proportion is an unbiased estimator of the true probability. Individual samples may overestimate or underestimate , but over many repeated experiments, their average equals the true value.
Since
its expectation is
Thus, on average,
Intuitively,
so
This explains why the observed proportion tends to approximate the true probability.
Although , different samples generally produce different values of .
The variance of the sample proportion is
so the standard deviation is
As the sample size increases, this quantity decreases, meaning that the observed values of become increasingly concentrated around .
The Law of Large Numbers states that
with high probability as the sample size grows.
The difference
is called the sampling error.
For sufficiently large sample sizes, concentration results such as Hoeffding’s inequality or the Central Limit Theorem show that this error is likely to be small.
Example : Suppose the true probability is
If we repeatedly perform the experiment, we might observe:
| Sample size () | Number of red marbles () | Observed proportion () |
|---|---|---|
| 10 | 7 | 0.70 |
| 100 | 61 | 0.61 |
| 1,000 | 602 | 0.602 |
| 10,000 | 5,991 | 0.5991 |
The observed proportion fluctuates for small samples but approaches the true probability as the sample size increases.
Similarly, if we repeatedly draw marbles from the same bin, we might obtain:
| Experiment | Observed proportion () |
|---|---|
| 1 | 0.66 |
| 2 | 0.73 |
| 3 | 0.71 |
| 4 | 0.69 |
| 5 | 0.75 |
Some estimates are above the true probability, while others are below it. However, the average of many such experiments approaches
Hoeffding’s Inequality
To quantify this relationship, we use one of the most important concentration results in probability theory: Hoeffding’s Inequality.
For a sample of size , Hoeffding’s Inequality states that, for any tolerance ,
Hoeffding’s inequality bounds the probability that the sampling error exceeds a chosen tolerance .
The probability that the observed proportion differs from the true probability by more than decreases exponentially as the sample size increases.
Only the sample proportion is random.
The true probability
is a fixed (but unknown) constant.
The randomness comes entirely from the random sample we draw.
Each new sample produces a different value of
while remains unchanged.
Therefore, the probability
is taken over all possible random samples of size .
The probability
depends on the unknown value of because
- appears inside the event,
- determines the distribution of the sample.
Hoeffding’s inequality replaces this unknown probability with the universal bound
which does not depend on at all.
Therefore, we obtain a guarantee that holds for every possible value of the unknown probability.
The bound depends only on
- the sample size ,
- the tolerance . It does not depend on
- the number of marbles in the bin,
- whether the bin is finite or infinite,
- the actual value of .
Consequently, whenever two experiments use the same sample size , Hoeffding’s inequality provides exactly the same probabilistic guarantee, regardless of the size of the underlying population.
The term
decreases exponentially with .
This means that doubling the sample size causes the probability of a large estimation error to decrease extremely rapidly.
As ,
Example: Applying Hoeffding’s Inequality
Suppose the true probability of drawing a red marble is
and we draw
marbles (with replacement).
We wish to bound the probability that the observed fraction of red marbles satisfies
Hoeffding’s inequality bounds events of the form
Since
the deviation from the true probability is
Since
Therefore,
Hoeffding’s inequality states
Using Exact Probability (Binomial Distribution)
Because each draw is independent with probability
the number of red marbles follows a Binomial distribution,
The condition
means that at most one red marble is observed:
Therefore,
Using the binomial probability formula,
Exactly 0 red marbles
Exactly 1 red marble
Hence,
| Exact Binomial probability | |
|---|---|
| Hoeffding upper bound |
Hoeffding’s inequality is satisfied.
Why Is the Hoeffding Bound So Loose : Hoeffding’s inequality is a universal concentration bound. It does not assume that the observations follow a Binomial distribution, nor does it exploit the fact that is very close to the extreme value of . It only assumes that each observation is bounded between and . Because it must provide a guarantee for every possible bounded distribution, it is necessarily conservative.
For small sample sizes such as
the bound can be much larger than the true probability. In this example,
so Hoeffding overestimates the probability by roughly a factor of 600.
Hoeffding’s inequality sacrifices tightness in exchange for universality : it guarantees correctness without requiring any knowledge of the underlying distribution beyond boundedness.
As the sample size increases, however, the exponential term
shrinks rapidly, and Hoeffding’s bound becomes increasingly informative and often much closer to the true probability.
Hoeffding’s inequality provides a distribution-free upper bound on the probability of large deviations between the sample proportion and the true probability.