The Formal Learning Problem

Imagine you want a program that looks at a medical scan and predicts whether a tumor is malignant. You have a few thousand past scans, each labeled by a radiologist. But you need the program to work correctly on scans it has never seen. This is the central puzzle of machine learning, stated without any algorithm yet in sight. What, precisely, are we trying to compute? How do we know when we have succeeded? Before we can discuss decision trees, neural networks, or support vector machines, we need a language precise enough to say what "success" even means. This precision matters enormously in practice. Every production ML system — a fraud detector, a recommendation engine, a self-driving perception stack — is a bet. It bets that patterns observed on past data will hold on future data. If that bet is not framed carefully, a system can appear to work perfectly in testing. Then it can fail catastrophically in deployment. The formal learning problem gives us the vocabulary to state the bet explicitly. We need an input space, an output space, an unknown probability distribution linking them. We also need a loss function that measures the cost of being wrong, and a risk we are trying to minimize. The big picture is this: learning is not curve-fitting for its own sake. It is decision-making under uncertainty about a distribution we cannot see directly. We only get a finite sample from that distribution. Yet we want a rule that performs well on the entire distribution. This includes points we will never observe during training. This gap between what we can measure (performance on a sample) and what we actually care about (performance on the distribution) is the single deepest idea in learning theory. It recurs in every later topic — overfitting, regularization, generalization bounds, cross-validation. This article builds the formal skeleton on which all of supervised learning hangs. It covers the definitions of input/output spaces, the unknown joint distribution, loss functions, and the risk functional we would minimize if we could. It sets up, but deliberately stops short of, the practical machinery. That machinery — Hypothesis Spaces and the distinction between Training Error vs Test Error — is built by later articles on top of this foundation.

Key takeaways
  • Learning means choosing a function f:X→Yf: \mathcal{X} \to \mathcal{Y} from a data-generating process we cannot observe directly.
  • Data is assumed to come i.i.d. from an unknown joint distribution P(X,Y)P(X, Y) over inputs and outputs.
  • A loss function L(y,y^)L(y, \hat y) quantifies the cost of predicting y^\hat y when the truth is yy.
  • The risk R(f)=E(x,y)∼P[L(y,f(x))]R(f) = \mathbb{E}_{(x,y)\sim P}[L(y, f(x))] is the quantity we truly want to minimize.
  • Because PP is unknown, we minimize the empirical risk on a finite sample instead — a proxy, not the goal.
  • The gap between empirical and true risk is exactly what later ideas like overfitting and generalization address.
The core insight

Learning is the search for a function that minimizes expected risk over an unknown distribution, using only a finite sample drawn from it as a stand-in for that distribution.

The idea

Formally, a learning problem is built from a small number of ingredients. The input space X\mathcal{X} is the set of all possible inputs — images, feature vectors, sequences, sensor readings. The output space Y\mathcal{Y} is the set of possible answers: a finite set of labels for classification, an interval of R\mathbb{R} for regression, or a structured object for structured prediction. A hypothesis, or predictor, is a function f:X→Yf: \mathcal{X} \to \mathcal{Y} (or, more generally, f:X→Rf: \mathcal{X} \to \mathbb{R} producing a score that is later thresholded or ranked). The crucial and easily overlooked assumption is that the pairs (x,y)(x, y) we observe are not arbitrary. We posit an unknown joint probability distribution P(X,Y)P(X, Y) over X×Y\mathcal{X} \times \mathcal{Y}, and we assume the training data D={(x1,y1),…,(xn,yn)}D = \{(x_1, y_1), \dots, (x_n, y_n)\} consists of nn samples drawn independently and identically distributed (i.i.d.) from PP. This single assumption is what makes learning from a finite sample meaningful at all: without some stable, repeatable regularity governing how inputs and outputs co-occur, no amount of past data could say anything about future data. Note that PP need not be deterministic — the same xx can produce different yy with different probabilities, reflecting real label noise (two radiologists might disagree on a borderline scan). To measure how bad a wrong prediction is, we introduce a loss function L:Y×Y→R≥0L: \mathcal{Y} \times \mathcal{Y} \to \mathbb{R}_{\ge 0}, where L(y,y^)L(y, \hat y) is the penalty for predicting y^\hat y when the true value is yy. Common choices include the 0-1 loss L(y,y^)=1[y≠y^]L(y, \hat y) = \mathbf{1}[y \ne \hat y] for classification, and the squared loss L(y,y^)=(y−y^)2L(y, \hat y) = (y - \hat y)^2 for regression. The loss function is a modeling choice — it encodes what "wrong" costs, and different applications (e.g. a false negative in cancer screening versus a false positive in spam filtering) may demand very different loss functions even on the same data. With these three ingredients — X,Y,P\mathcal{X}, \mathcal{Y}, P — and a loss LL, we can finally define the object learning theory revolves around: the expected risk (also called the true risk or generalization risk) of a hypothesis ff,

R(f)  =  E(x,y)∼P[ L(y,f(x)) ]  =  ∫X×YL(y,f(x)) dP(x,y).R(f) \;=\; \mathbb{E}_{(x,y)\sim P}\big[\,L(y, f(x))\,\big] \;=\; \int_{\mathcal{X}\times\mathcal{Y}} L(y, f(x))\, dP(x,y).

The formal learning problem is to find

f⋆=arg⁡min⁡f∈FR(f)f^\star = \arg\min_{f \in \mathcal{F}} R(f)

over some class of admissible functions F\mathcal{F} (a topic taken up in Hypothesis Spaces). The unattainable ideal, fBayes⋆=arg⁡min⁡fR(f)f^\star_{\text{Bayes}} = \arg\min_{f} R(f) over all measurable functions, is called the Bayes optimal predictor; its risk R(fBayes⋆)R(f^\star_{\text{Bayes}}) is the Bayes risk, the fundamental floor of error that not even infinite data and infinite compute can beat, because it is driven by irreducible noise in PP itself.

How it works

There is no "algorithm" for the formal learning problem itself — it is a specification, not a procedure. But it is worth walking through, step by step, exactly how this specification is turned into something computable, because the translation from the ideal (unknown PP) to the practical (a finite sample) is the mechanism every learning algorithm actually implements.

Step 1 — Define the spaces. Fix X\mathcal{X} (e.g., Rd\mathbb{R}^d for feature vectors) and Y\mathcal{Y} (e.g., {−1,+1}\{-1, +1\} for binary classification, or R\mathbb{R} for regression).

Step 2 — Posit the distribution. Assume there is a fixed, unknown P(X,Y)P(X,Y) generating all data of interest, past and future. We never get to see PP; we only see samples from it.

Step 3 — Choose a loss. Pick L(y,y^)L(y, \hat y) appropriate to the task and its real-world costs.

Step 4 — State the ideal objective. The true goal is min⁡fR(f)=min⁡fE(x,y)∼P[L(y,f(x))]\min_f R(f) = \min_f \mathbb{E}_{(x,y)\sim P}[L(y, f(x))]. This cannot be computed directly since PP is unknown — there is no way to take an expectation over a distribution you cannot write down.

Step 5 — Approximate with a finite sample. Draw D={(xi,yi)}i=1nPD = \{(x_i, y_i)\}_{i=1}^n \overset{\text{i.i.d.}}{\sim} P. Replace the true distribution with the empirical distribution P^n\hat P_n that places mass 1/n1/n on each observed point. This yields the empirical risk:

R^n(f)=1n∑i=1nL(yi,f(xi)).\hat R_n(f) = \frac{1}{n}\sum_{i=1}^n L(y_i, f(x_i)).

Step 6 — Minimize the proxy. Every concrete learning algorithm (linear regression, logistic regression, a neural network trained by backpropagation, a decision tree splitting criterion) is, at heart, an optimization procedure that approximately solves

f^n=arg⁡min⁡f∈FR^n(f)\hat f_n = \arg\min_{f \in \mathcal{F}} \hat R_n(f)

over some restricted hypothesis class F\mathcal{F} (never all measurable functions — that would let the optimizer memorize the sample with zero empirical risk while learning nothing generalizable). This restriction is the subject of Hypothesis Spaces.

Step 7 — Hope, and later verify, that R^n(f)\hat R_n(f) tracks R(f)R(f). The entire theoretical apparatus of generalization bounds exists to control the gap ∣R^n(f)−R(f)∣|\hat R_n(f) - R(f)|, which is exactly the subject taken up under Training Error vs Test Error. ``` ALGORITHM: EmpiricalRiskMinimization(D, F, L) Input: D = {(x_1, y_1), ..., (x_n, y_n)} // i.i.d. sample from unknown P F // hypothesis class (restricted!) L // loss function // Step 1: define the computable proxy for the true risk define R_hat(f) := (1/n) sum_{i=1..n} L(y_i, f(x_i)) // Step 2: search F for a minimizer of the proxy f_hat := argmin_{f in F} R_hat(f) // Step 3: return the learned predictor return f_hat // NOTE: R(f) = E_{(x,y)~P}[L(y, f(x))] is NEVER computed here — // P is unknown. R_hat(f) is the only quantity the algorithm // ever touches. The entire theory of generalization is about // how well R_hat(f_hat) approximates R(f_hat), and how far // R(f_hat) is from R(f) = min_{f in F} R(f). ``` The pseudocode above is deliberately generic: whether F\mathcal{F} is the set of linear functions, decision trees of depth ≤k\le k, or a fixed-architecture neural network, and whatever optimizer is used (closed-form least squares, gradient descent, greedy tree splitting), the shape of the problem is always: minimize an empirical average of losses in place of an unreachable expectation. This is why the formal learning problem is foundational — it is the common abstraction underlying every algorithm covered elsewhere in the curriculum.

Figure
From the unknown distribution to the computable proxy
Unknown P(X, Y) joint distribution over inputs 𝒳 and outputs 𝒴 never directly observed i.i.d. draw Finite sample D (x₁,y₁), (x₂,y₂), …, (xₙ,yₙ) n observed pairs the only thing we can compute with Loss function L(y, ŷ) 0-1 loss, squared loss, etc. encodes the cost of an error True risk R(f) = E_(x,y)~P [ L(y, f(x)) ] the real goal — unreachable Empirical risk R̂ₙ(f) = (1/n) Σ L(yᵢ, f(xᵢ)) computable — what algorithms minimize approximates The whole of learning theory studies the gap between R̂ₙ(f) and R(f).

Complexity & correctness

Complexity. The formal learning problem itself has no algorithmic complexity — it is a mathematical statement, not a procedure — but the empirical-risk-minimization proxy that instantiates it does. Given nn samples in X⊆Rd\mathcal{X} \subseteq \mathbb{R}^d:

  • Computing R^n(f)\hat R_n(f) for a fixed ff costs O(n)O(n) loss evaluations, each O(1)O(1) to O(d)O(d) depending on how f(xi)f(x_i) is computed, giving O(nd)O(nd) total for one evaluation of the empirical risk.
  • Minimizing R^n(f)\hat R_n(f) over F\mathcal{F} is where all the real cost lives, and it is entirely algorithm-dependent: closed-form linear least squares costs O(nd2+d3)O(nd^2 + d^3) via normal equations; gradient-based methods cost O(nd)O(nd) per iteration times the number of iterations; tree-based greedy splitting costs O(ndlog⁡n)O(nd\log n) per level. None of this complexity is dictated by the formal learning problem itself — it is dictated by the choice of F\mathcal{F} and optimizer, which is exactly why the problem statement is deliberately separated from the algorithm.
  • Space is O(nd)O(nd) to hold the sample, plus whatever the hypothesis class needs to store its parameters (e.g., O(d)O(d) for a linear model, O(number of nodes)O(\text{number of nodes}) for a tree).

The one complexity fact that is intrinsic to the formal learning problem is statistical, not computational: as n→∞n \to \infty, under mild regularity conditions, R^n(f)→R(f)\hat R_n(f) \to R(f) almost surely for any fixed ff, by the strong law of large numbers, since R^n(f)\hat R_n(f) is literally a sample average of the i.i.d. random variables L(yi,f(xi))L(y_i, f(x_i)). The rate of this convergence, uniformly over an entire hypothesis class F\mathcal{F} rather than a single fixed ff, is governed by concentration inequalities and complexity measures of F\mathcal{F} (VC dimension, Rademacher complexity) — this is precisely the machinery developed under Training Error vs Test Error and is foreshadowed, not derived, here.

Correctness. What does "correctness" even mean for a specification with no algorithm? It means the following chain of reasoning holds: 1. Well-posedness: because (xi,yi)(x_i,y_i) are i.i.d. draws from a single fixed PP, the quantity L(yi,f(xi))L(y_i, f(x_i)) for fixed ff is itself an i.i.d. sequence of real-valued random variables with mean R(f)R(f). This is what licenses calling R^n(f)\hat R_n(f) an unbiased estimator of R(f)R(f):

ED[R^n(f)]=1n∑i=1nE[L(yi,f(xi))]=R(f).\mathbb{E}_D[\hat R_n(f)] = \frac{1}{n}\sum_{i=1}^n \mathbb{E}[L(y_i, f(x_i))] = R(f).

2. Consistency for a fixed ff: by the law of large numbers, R^n(f)→R(f)\hat R_n(f) \to R(f) in probability (and almost surely) as n→∞n \to \infty, for any fixed ff with finite loss variance. 3. The subtlety: point 2 holds for one fixed ff chosen before seeing the data. But empirical risk minimization chooses f^n\hat f_n after seeing the data, specifically to make R^n(f^n)\hat R_n(\hat f_n) small — so R^n(f^n)\hat R_n(\hat f_n) is a biased (optimistically low) estimate of R(f^n)R(\hat f_n). This is the formal origin of overfitting, and it is exactly why R^n(f^n)≠R(f^n)\hat R_n(\hat f_n) \ne R(\hat f_n) in general, and why held-out test data is needed to estimate R(f^n)R(\hat f_n) honestly. This tension is the seed from which Training Error vs Test Error grows. 4. Bayes-optimality as ground truth: for 0-1 loss and known PP, the function f⋆(x)=arg⁡max⁡yP(Y=y∣X=x)f^\star(x) = \arg\max_y P(Y = y \mid X = x) provably minimizes R(f)R(f) over all functions — a fact provable by pointwise minimization of the conditional risk E[L(Y,f(x))∣X=x]\mathbb{E}[L(Y, f(x)) \mid X = x] for each xx independently, since the overall risk is an expectation (integral) over xx of these conditional risks, and each is minimized independently by choosing the most probable class. This gives a concrete, checkable sense in which the formal setup is "correct": it recovers exactly the intuitively right answer (predict the most likely label) when PP is fully known.

Honest tradeoffs. The formal framework assumes i.i.d. data from a fixed distribution — violated by distribution shift, temporal drift, or adversarial adaptation, all common in deployed systems. It also assumes the loss function fully captures real-world costs, which is often only an approximation (e.g., 0-1 loss ignores calibration, squared loss is sensitive to outliers). None of these are flaws in the framework so much as reminders that it is an idealization whose assumptions must be checked against reality.

Worked example

Consider a tiny, fully concrete instance to make every symbol tangible. Suppose X={\mathcal{X} = \{small, medium, large}\} (house sizes, categorical) and Y={0,1}\mathcal{Y} = \{0, 1\} (0 = "sells under $300k", 1 = "sells over $300k"). Suppose, purely for illustration, that the true (unknown, in reality) joint distribution PP is:

xxP(x)P(x)P(Y=1∣x)P(Y{=}1 \mid x)
small0.50.10
medium0.30.60
large0.20.95

We use 0-1 loss: L(y,y^)=1[y≠y^]L(y,\hat y) = \mathbf 1[y \ne \hat y]. If we knew PP (which real learners never do), the Bayes-optimal classifier predicts the majority label per xx: y^=0\hat y=0 for small (P(Y=1)=0.10<0.5P(Y{=}1)=0.10<0.5), y^=1\hat y = 1 for medium and large. Its Bayes risk is:

R(fBayes⋆)=0.5(0.10)+0.3(0.40)+0.2(0.05)=0.05+0.12+0.01=0.18.R(f^\star_{\text{Bayes}}) = 0.5(0.10) + 0.3(0.40) + 0.2(0.05) = 0.05 + 0.12 + 0.01 = 0.18.

Even the best possible classifier is wrong 18% of the time — this is irreducible noise, not a flaw of any algorithm. Now suppose we don't know PP; we only observe a sample of n=10n = 10 houses drawn i.i.d. from it:

iixix_iyiy_i
1small0
2small0
3small0
4small1
5medium1
6medium0
7medium1
8large1
9large1
10large0

Consider the hypothesis class F={\mathcal{F} = \{all functions constant on each of the three categories}\} (equivalent to 23=82^3 = 8 possible predictors, one bit per category). Empirical risk minimization picks, for each category, whichever label is the sample majority within that category:

  • small: labels {0,0,0,1}\{0,0,0,1\} → majority 0, empirical error contribution 1/41/4 within-group.
  • medium: labels {1,0,1}\{1,0,1\} → majority 1, empirical error contribution 1/31/3 within-group.
  • large: labels {1,1,0}\{1,1,0\} → majority 1, empirical error contribution 1/31/3 within-group.

This exactly recovers f^n(small)=0\hat f_n(\text{small}) = 0, f^n(medium)=1\hat f_n(\text{medium}) = 1, f^n(large)=1\hat f_n(\text{large}) = 1 — matching the true Bayes rule in this case, purely because nn happened to be large enough for majorities to align. The empirical risk is:

R^10(f^n)=110(1⏟small,i=4+1⏟medium,i=6+1⏟large,i=10)=310=0.30.\hat R_{10}(\hat f_n) = \frac{1}{10}\big(\underbrace{1}_{\text{small}, i=4} + \underbrace{1}_{\text{medium}, i=6} + \underbrace{1}_{\text{large}, i=10}\big) = \frac{3}{10} = 0.30.

Notice R^10(f^n)=0.30≠R(f^n)=R(fBayes⋆)=0.18\hat R_{10}(\hat f_n) = 0.30 \ne R(\hat f_n) = R(f^\star_{\text{Bayes}}) = 0.18: the empirical risk on this particular small sample overestimates the true risk here (it could equally have underestimated it with different random draws), illustrating concretely that R^n(f)\hat R_n(f) is only a noisy, sample-dependent proxy for R(f)R(f) — exactly the point the LLN-based argument made abstractly above. With n=10n=10, sampling noise is large; as nn grows toward thousands, the law of large numbers guarantees R^n(f^n)\hat R_n(\hat f_n) will concentrate tightly around the true risk of whatever function is learned — the quantitative rate of that concentration is the subject taken up next in Training Error vs Test Error.

Common pitfalls & traps

PitfallWhy it happensConsequence
Treating R^n(f)\hat R_n(f) as if it equals R(f)R(f)Conflating the computable proxy with the true objectiveFalse confidence; the model looks great on training data but fails in deployment
Assuming the loss function is "obviously correct"Defaulting to 0-1 or squared loss without checking real costsMisaligned incentives, e.g. penalizing false positives and false negatives equally when they are not equally bad
Ignoring the i.i.d. assumptionData collected over time, geography, or with feedback loopsDistribution shift silently invalidates the entire formal setup
Choosing F\mathcal{F} = all functionsBelieving "more flexible is always better"Empirical risk can be driven to zero by memorization, with no bearing on true risk
Forgetting the Bayes risk floorExpecting a perfect model to existWasted effort chasing zero error when noise in PP makes it mathematically impossible
Re-using the same sample to both fit and evaluateNo separate estimate of R(f)R(f) is availableSystematically optimistic risk estimates, the seed of overfitting analysis

Pioneers & history

The formal learning problem as stated here — unknown distribution, loss function, expected risk — crystallized out of decades of work bridging probability theory, statistics, and computer science.

Origins · 1 minAndrey Kolmogorov and how this was discovered
AK
Andrey Kolmogorov
1903–1987 · Soviet mathematician who built the measure-theoretic axioms of probability

Kolmogorov's 1933 axiomatization of probability gave the rigorous foundation — probability spaces, random variables, expectation as an integral — without which terms like "unknown distribution P(X,Y)P(X,Y)" and "expected risk E[L(y,f(x))]\mathbb{E}[L(y,f(x))]" would have no precise meaning at all.

:::physicist[Vladimir Vapnik|born 1936|co-creator, with Alexey Chervonenkis, of statistical learning theory| Vapnik formalized empirical risk minimization as the central object of learning theory and, with Chervonenkis, developed VC dimension to explain when and why minimizing empirical risk over a restricted hypothesis class controls the true risk — directly foreshadowing the next topic in this sequence.

Origins · 1 minhow this was discovered
History
1933
— Kolmogorov axiomatizes probability, giving expectation and distributions rigorous mathematical footing.
1960
— Rosenblatt's perceptron popularizes learning-from-examples as a computational, not just statistical, question.
1971
— Vapnik and Chervonenkis publish uniform convergence results relating empirical and true risk.
1984
— Valiant introduces Probably Approximately Correct (PAC) learning, formalizing sample-complexity guarantees.
1995
— Vapnik's "The Nature of Statistical Learning Theory" consolidates risk minimization as the field's central paradigm.

Where this matters

Every supervised learning system deployed today is, underneath its specific architecture, an instance of empirical risk minimization standing in for the formal learning problem. Search ranking systems minimize a proxy for the risk of showing irrelevant results; recommendation engines minimize a proxy for the risk of recommending items users won't engage with; medical diagnosis models minimize a proxy for the risk of misclassifying a scan, often with an asymmetric loss that penalizes missed cancers far more than false alarms. Autonomous vehicle perception stacks are trained by minimizing empirical risk over enormous labeled datasets, with the entire safety case resting on the (imperfect) assumption that deployment-time driving conditions resemble the training distribution. The formal framework also underlies the theoretical guarantees that regulators and engineers increasingly demand: PAC-learning bounds, generalization certificates, and risk-based model cards all trace back to this same skeleton — an unknown PP, a loss LL, a true risk R(f)R(f), and an empirical proxy R^n(f)\hat R_n(f). Understanding this skeleton is what lets a practitioner diagnose why a model that looked perfect in a notebook fails in production: almost always, it is because R^n(f)\hat R_n(f) and R(f)R(f) silently diverged, a phenomenon the next articles on Hypothesis Spaces and Training Error vs Test Error explain in full quantitative detail. It is also the conceptual backbone connecting supervised learning to the broader landscape introduced in Types of Learning: Supervised, Unsupervised, Reinforcement, since even unsupervised and reinforcement learning formulations define analogous risk functionals over their own respective distributions and loss (or reward) structures.

Ask the tutor: If the empirical risk is a biased estimate of the true risk once we've chosen the minimizing hypothesis, how do held-out test sets and cross-validation actually fix this problem?

Is the "unknown distribution" assumption realistic, or just a convenient fiction?

It is a genuine modeling idealization, but a useful and largely necessary one. In reality, data-generating processes may drift over time, differ by subgroup, or be affected by feedback loops from the model's own predictions — all violations of the fixed-PP, i.i.d. assumption. Despite this, assuming a fixed unknown PP gives a tractable starting point from which deviations (distribution shift, non-stationarity, selection bias) can be explicitly studied and corrected for, rather than left implicit and unexamined. Nearly all of statistical learning theory, and the diagnostic tools practitioners use daily (train/validation/test splits, cross-validation, monitoring for drift), exist specifically to detect and manage violations of this idealization.

Why do we minimize empirical risk instead of true risk if true risk is what we actually care about?

Because true risk R(f)=E(x,y)∼P[L(y,f(x))]R(f) = \mathbb{E}_{(x,y)\sim P}[L(y,f(x))] requires integrating against PP, and PP is never available to us — we only ever observe samples drawn from it. Empirical risk R^n(f)\hat R_n(f) is the only quantity computable from data alone, and by the law of large numbers it converges to the true risk for any fixed ff as the sample size grows. Minimizing it is therefore the natural, essentially forced, computational surrogate; the entire theoretical machinery of generalization bounds exists to quantify precisely how good this surrogate is, especially once ff itself is chosen based on the same data.

What's the difference between the loss function and the risk?

The loss function L(y,y^)L(y, \hat y) is a pointwise, deterministic measure of how bad one specific prediction is — it takes a true label and a predicted label and returns a single non-negative number. The risk R(f)R(f) is a single scalar summarizing the average loss of an entire function ff over the whole distribution of possible inputs and outputs: R(f)=E(x,y)∼P[L(y,f(x))]R(f) = \mathbb{E}_{(x,y)\sim P}[L(y, f(x))]. In short, the loss evaluates one prediction; the risk evaluates an entire predictor's overall quality across every scenario it might encounter.

What exactly is the Bayes optimal predictor, and why does it matter?

For 0-1 loss, the Bayes optimal predictor is f⋆(x)=arg⁡max⁡yP(Y=y∣X=x)f^\star(x) = \arg\max_y P(Y=y \mid X=x): at each input, predict whichever label is most probable given that input. It is provably the risk-minimizing function among all possible functions, not just those in some restricted hypothesis class, because minimizing the overall expected risk reduces to independently minimizing the conditional risk at each xx. It matters because its risk, the Bayes risk, is a hard floor: even with infinite data and unlimited model capacity, no classifier can do better, since remaining errors stem from genuine randomness in P(Y∣X)P(Y\mid X) rather than from any deficiency of the learning algorithm.

How does the choice of loss function change what "optimal" means?

Different loss functions define different optimal predictors and, often, different optimal predicted quantities entirely. Squared loss (y−y^)2(y - \hat y)^2 is minimized in expectation by predicting the conditional mean E[Y∣X=x]\mathbb{E}[Y \mid X=x], while absolute loss ∣y−y^∣|y - \hat y| is minimized by the conditional median, and 0-1 loss is minimized by the conditional mode (most likely class). Choosing a loss function is therefore not a cosmetic detail — it is a substantive statement about which statistic of the conditional distribution P(Y∣X)P(Y\mid X) you actually want your model to output, and mismatched loss choices can silently target the wrong quantity.

Does this framework apply outside supervised learning, e.g. to unsupervised or reinforcement learning?

The same skeleton generalizes, though the specifics change. In unsupervised learning there is no label yy; instead one might define a risk over reconstruction loss (autoencoders) or a likelihood-based objective over an unknown distribution P(X)P(X) alone. In reinforcement learning, the analogous object is expected cumulative reward under an unknown environment dynamics and reward distribution, with a policy playing the role of the hypothesis. In every case, as introduced conceptually in Types of Learning: Supervised, Unsupervised, Reinforcement, the core tension persists: an unknown generative process, a proxy objective computable from finite interaction or data, and a gap between the two that theory must bound.

Why does this article stop short of discussing hypothesis space restrictions and generalization bounds?

Because those are logically separate concerns layered on top of the formal learning problem, not part of its basic statement. This article establishes what quantity we want to minimize (true risk) and what we can actually compute (empirical risk over a sample); it deliberately does not yet address which functions we are allowed to search over (the subject of Hypothesis Spaces) or how tightly empirical performance predicts true performance (the subject of Training Error vs Test Error). Separating these questions keeps each one precise and avoids conflating a definitional foundation with the theorems built on top of it.

Before this

Where this leads