For a random classifier determined by training information , and an independent test pair , its conditional misclassification risk is . It is itself a training-dependent random variable. The tower property of conditional expectation gives .
One-nearest-neighbour classifier Created 2026-10-05 Updated 2026-10-14
The classifier that assigns the query the label of its closest training feature, using feature-measurable nearest-neighbour tie-breaking. Its misclassification risk need not converge to Bayes risk, even with infinitely many independent and identically distributed random variables as training data.
Choose a Borel measurable function version of the posterior success probability . Conditional on , predicting zero has error probability and predicting one has error probability . A Bayes classifier for zero-one loss is therefore
Either decision is optimal when . The displayed Bayes risk also equals and is unaffected by changing on a -null set.
For any measurable set , independence and the uniform distribution of give
Likewise the probability with label zero is . These sets determine the joint probability distribution, so
The same construction makes all training pairs independent and identically distributed random variables.
Fix a feature-measurable nearest-neighbour tie-breaking rule, for example increasing original index for observations at equal Euclidean norm distance from the query. This is important: the ordering may depend on the features, but not on the or labels. Let be the label attached to the th ordered feature. The classifier from the K-nearest neighbors algorithm is
The displayed rule resolves a tied vote in favour of one; any fixed vote convention would also define the method. When , this is the one-nearest-neighbour classifier .
Write for the selected original index. Conditional on all features , it is fixed, and is still uniform on . The two decisions being compared are
The latter is an oracle comparison rule: its relabeling is recomputed at each query , rather than being a fixed relabeling of the training data for all queries. For a variable with the uniform distribution on , the two threshold indicators at differ exactly when lies between them, an interval of length . This Bernoulli coupling by a shared uniform random variable proves
Take the test pair independent of the training data and its auxiliary uniforms. Let , and interpret as conditional misclassification risk given . The tower property of conditional expectation gives . Conditional on the test feature and all training features, and are independent variables with a Bernoulli distribution of parameter . Consequently, for every ,
This is an exact finite-sample equality, not merely a limit.
The two error indicators can differ only if the two classifiers disagree, so
The permitted nearest-neighbour approximation theorem states that the last expected value tends to zero for the feature-based selection rule. This establishes the one-nearest-neighbour asymptotic risk
For , put . Then , and . Integrating gives the Bayes risk bound for one-nearest-neighbour classification
Thus a one-nearest-neighbour classifier need not achieve the Bayes risk: for constant , its limiting misclassification risk is , while .
Feature-based neighbour tie-breaking is required. The convention cannot be dropped for arbitrary . For a counterexample, take almost surely and constant , and choose among the coincident neighbours the one with the smallest . Then the predicted label is one with probability , so its misclassification risk tends to , exceeding the claimed upper bound . The corrected theorem uses ties determined independently of the uniforms and labels, as above.
For define the misclassification loss
and take the loss class
Write and , so the misclassification risk and empirical misclassification risk are and .
Because is an empirical risk minimizer, . Hence its excess risk obeys
Introduce an independent ghost sample and perform Rademacher symmetrization. The contribution involving the fixed function has zero expectation over the Rademacher signs, so each of the two independent sample terms has supremum expectation . Therefore
Every difference takes values in . Replacing one observation can consequently change by at most . Applying the Bounded differences inequality with gives, except on an event of probability at most ,
Combining these inequalities proves, with probability at least ,
For a zero-one-valued loss class , the excess misclassification risk of an empirical risk minimizer over a population minimizer satisfies
with probability at least . The proof combines Rademacher symmetrization with the Bounded differences inequality for the supremum of the empirical excess-loss process.
The observable version is
It follows by another application of the Bounded differences inequality to the Empirical Rademacher complexity.