Tutorials › Exam SRM - Statistics for Risk Modeling › Classification Complexity Without a Regression Loss

Exam SRM · Bias, Variance, and Overfitting · Tutorial 770 of 926

Classification Complexity Without a Regression Loss

Compare training and validation classification error across model complexity, and identify why squared-error decomposition is not the right tool for misclassification loss.

Intermediate 11 min read

What You'll Learn

  • Define binary misclassification loss and population classification error
  • Explain why training error cannot increase across nested classifier classes when each is optimized
  • Interpret training and validation error patterns as classifier flexibility increases
  • Derive the conditional misclassification risk for predicting either binary class
  • Explain why the standard squared-error bias-variance decomposition does not directly apply
  • Recognize how a highly flexible classifier can fit training labels but perform poorly on new cases

Classification Error and Model Complexity

A binary classifier assigns each case to one of two labels, such as whether a hypothetical claim requires additional review. Increasing flexibility gives the classifier more ways to separate the labels in the training data. That can reduce training mistakes, but a more complicated boundary may also react to accidental features of the sample and make worse predictions for new cases.

The key quantity here is misclassification error: whether a predicted label matches the actual label. It is not the squared difference between a numeric response and a fitted value. That distinction matters because the familiar squared-error bias-variance decomposition relies on squared loss and does not transfer directly to the zero-one loss used to count classification mistakes.

Definition: Let \(Y\in\{0,1\}\) be the class label, \(X\) the predictor information, and \(g(X)\in\{0,1\}\) a classifier. The zero-one loss for one case is \(I\{g(X)\ne Y\}\), equal to 1 for a wrong classification and 0 for a correct one. The population classification error is \(P(g(X)\ne Y)\). For a training sample of size \(n\), the training classification error is the fraction of its cases classified incorrectly.

A classifier class, or model class, is a collection of prediction rules. A more flexible class can represent more possible decision boundaries. When classes are nested, every rule available to a simpler class is also available to the more flexible class. If each class is fitted by minimizing training error, then its minimum training error cannot increase as the class expands: the larger class can always choose the old rule, or a rule that does better.

$$ \min_{g\in\mathcal{G}_{\text{large}}}\widehat{R}_{\text{train}}(g) \le \min_{g\in\mathcal{G}_{\text{small}}}\widehat{R}_{\text{train}}(g), \qquad \mathcal{G}_{\text{small}}\subseteq\mathcal{G}_{\text{large}}. $$

This is a statement about the optimized training error, not a guarantee about validation or population error. A flexible classifier may use a complicated boundary to fit unusual cases in the training sample. If those patterns do not persist in new cases, the extra flexibility can increase error outside the sample.

Worked Example: Comparing Three Levels of Flexibility

A hypothetical review team evaluates three nested classifiers using 24 training cases and a separate validation set of 12 cases. The simplest rule divides cases into two broad groups; the intermediate rule allows several segments; the most flexible rule can create a highly detailed boundary. The observed counts of misclassifications are below. Compare the error rates and determine which classifier has the lowest validation error.

ClassifierTraining errorsTraining error rateValidation errorsValidation error rate
Simple8 of 248/24 = 0.33333 of 123/12 = 0.2500
Intermediate4 of 244/24 = 0.16672 of 122/12 = 0.1667
Highly flexible0 of 240/24 = 0.00005 of 125/12 = 0.4167

Step 1: Calculate each rate. Divide the error count by the number of cases in the corresponding set. For example, the simple classifier’s training error is \(8/24=0.3333\), while its validation error is \(3/12=0.2500\). The other rates are shown in the table.

Step 2: Compare training performance. Training error falls from 0.3333 to 0.1667 to 0.0000 as flexibility increases. This matches the nested-class result: the most flexible classifier can fit all 24 training labels.

Step 3: Compare validation performance. The intermediate classifier has the lowest observed validation error, \(2/12=0.1667\). The highly flexible classifier has the highest, \(5/12=0.4167\), despite its perfect training classification.

Conclusion and check. On these validation cases, the intermediate classifier performs best. The training and validation denominators are different, so their raw counts should not be compared directly; compare rates. The zero training error is not evidence of zero population error. A common mistake would be to choose the highly flexible classifier just because it makes no training mistakes.

What Misclassification Risk Measures

For a binary response, define \(\eta(x)=P(Y=1\mid X=x)\), the conditional probability of class 1 at predictor value \(x\). If a classifier predicts 1 at \(x\), it is wrong exactly when \(Y=0\), which has conditional probability \(1-\eta(x)\). If it predicts 0, it is wrong exactly when \(Y=1\), which has conditional probability \(\eta(x)\). Thus the conditional misclassification risks are:

$$ P(g(X)\ne Y\mid X=x)= \begin{cases} \eta(x), & g(x)=0,\\ 1-\eta(x), & g(x)=1. \end{cases} $$

This also gives the best possible prediction at a fixed \(x\) when the two kinds of mistake have equal cost: choose the label with greater conditional probability. Predict 1 when \(\eta(x)>1/2\), and predict 0 when \(\eta(x)<1/2\). Either label has the same conditional risk when \(\eta(x)=1/2\). Even this best rule can make mistakes when the conditional distribution assigns positive probability to both labels.

Worked Example: Calculating the Best Possible Classification Error

In a hypothetical screening population, predictor information divides cases into four equally likely groups. The probabilities of class 1 in groups A through D are 0.05, 0.30, 0.70, and 0.95, respectively. Calculate the error rate for the rule that always predicts 1, the rule that always predicts 0, and the best rule that can use group membership.

Step 1: Calculate the class 1 probability overall. Since each group has probability \(1/4\),

$$ P(Y=1)=\frac{0.05+0.30+0.70+0.95}{4} =\frac{2.00}{4}=0.50. $$

The always-1 rule is wrong when \(Y=0\), so its error rate is \(1-0.50=0.50\). The always-0 rule is wrong when \(Y=1\), so its error rate is also \(0.50\).

Step 2: Choose the more likely label in each group. The rule predicts 0 in A and B, where the class 1 probabilities are below 0.50, and predicts 1 in C and D, where they are above 0.50.

Step 3: Calculate the group-specific error contributions. In A the error probability is 0.05; in B it is 0.30; in C it is \(1-0.70=0.30\); and in D it is \(1-0.95=0.05\). Weight each by the group probability:

$$ P(g(X)\ne Y) =\frac{0.05+0.30+0.30+0.05}{4} =\frac{0.70}{4}=0.175. $$

Conclusion and check. The group-based rule has error 0.175, less than the 0.50 error of either constant rule. It is not error-free: groups A through D have nonzero probabilities of both labels. The common mistake is to count a group’s majority label as if every case in that group had that label.

Why the Squared-Error Decomposition Does Not Transfer Directly

For numeric prediction under squared-error loss, the standard bias-variance-noise decomposition separates expected prediction error into squared bias, variance across training samples, and irreducible noise. Its algebra depends on squaring differences between numeric quantities and expanding those squares. Misclassification loss is instead an indicator: a prediction contributes either 0 or 1, according to whether its label matches the observed label.

The conditional-risk calculation above shows the relevant structure directly. At \(x\), the risk of predicting 0 is \(\eta(x)\); the risk of predicting 1 is \(1-\eta(x)\). The minimum conditional risk is therefore \(\min\{\eta(x),1-\eta(x)\}\). This describes the unavoidable classification error at \(x\) under zero-one loss, not a squared residual around a numeric fitted value.

A classifier can also change its predicted label abruptly as a fitted boundary shifts, even if its underlying estimated probabilities change only slightly. As a result, the standard squared-error identity does not provide a direct additive accounting of misclassification error into squared bias, variance, and noise. Classification error can still be studied through changes in fitted predictions across training samples, but that analysis requires care about the loss and the target being measured.

Key distinction: Under zero-one loss, the prediction is judged by whether its class is correct. Under squared-error loss, the prediction is judged by the numerical size of a residual. Do not insert classification error into the standard squared-error bias-variance formula as though the two losses were interchangeable.

Flexibility, Sample Sensitivity, and Overfitting

One way flexibility can harm classification is by making the fitted label highly dependent on which training cases happened to be observed. A very local rule can reproduce each training label but change its prediction near a boundary when the sample changes. That is one mechanism behind the combination of low training error and higher error on new cases.

For example, a one-nearest-neighbor classifier predicts the label of the training case closest to the new predictor value. If all training predictor values are distinct, each training case is its own closest neighbor at its observed value, so the classifier makes no training errors. That property alone says nothing about its error on an independent case.

Worked Example: Zero Training Error Does Not Ensure Low Population Error

Consider a hypothetical local region of a predictor space in which \(P(Y=1\mid X=x)=0.60\) for every \(x\). Assume labels of distinct cases are independent conditional on their predictor values, and the training predictor values are distinct. Compare the population error at a new case in this region for a one-nearest-neighbor classifier with the error for the fixed rule that always predicts 1.

Step 1: Calculate the one-nearest-neighbor error. The nearest training label is 1 with probability 0.60 and 0 with probability 0.40. The new case’s label is also 1 with probability 0.60 and 0 with probability 0.40, independently under the stated assumptions. The two labels disagree in either of two ways:

$$ P(\text{error}) =P(\text{training label}=1,\ Y=0) +P(\text{training label}=0,\ Y=1) =(0.60)(0.40)+(0.40)(0.60)=0.48. $$

Step 2: Calculate the fixed-rule error. The always-1 rule is wrong when the new label is 0, so its error is \(1-0.60=0.40\).

Step 3: Compare with training performance. With distinct training predictor values, one-nearest-neighbor predicts each training case’s own label, giving training error 0. Yet its population error in this region is 0.48, greater than the fixed rule’s 0.40.

Conclusion and check. The calculation depends on the stated constant conditional probability and independence assumptions; it is an illustration, not a universal error formula for nearest neighbors. The key trap is to treat perfect reproduction of observed labels as evidence of strong performance on new cases.

The example also shows why classification performance cannot be summarized by training accuracy alone. Flexibility may let a rule fit sample-specific label variation, while a simpler rule can be more stable. This is consistent with the broader bias-variance principle: overly simple rules can miss real structure, while overly flexible rules can react to noise. For classification, assess that tradeoff using a classification loss and data not used to fit the rule, rather than assuming the regression squared-error decomposition applies.

1
State the prediction target.
Identify the two labels and define what counts as a misclassification.
2
Compare fitted error rates.
Use error counts divided by the appropriate sample sizes; do not compare raw counts from sets of different sizes.
3
Interpret complexity cautiously.
A lower optimized training error is expected in nested classes, but it does not imply lower validation or population error.
4
Use the loss-specific reasoning.
For zero-one loss, calculate error from the probabilities of the two labels. Do not apply the standard squared-error decomposition unchanged.

These distinctions are aligned with the SOA Exam SRM (Statistics for Risk Modeling) syllabus. In a classification problem, state whether an error rate is measured on training data or on data not used for fitting, and keep the loss definition explicit. That prevents the common errors of equating training fit with generalization, or of importing a regression formula without checking its assumptions.

Check Your Understanding

Work each problem using the stated classification loss and assumptions.

  1. A simple classifier makes 9 errors in 30 training cases and 2 errors in 10 validation cases. A nested flexible classifier makes 3 training errors and 4 validation errors. Calculate all four error rates and state which has lower observed validation error. (Answer: Simple: training 0.3000 and validation 0.2000; flexible: training 0.1000 and validation 0.4000; the simple classifier has lower validation error.)
  2. Two equally likely groups have conditional class 1 probabilities 0.20 and 0.80. What is the error rate of the best rule using group membership, and what is the error rate of either constant-label rule? (Answer: Group-based error \(=(0.20+0.20)/2=0.2000\); either constant rule has error 0.5000.)
  3. In a region with \(P(Y=1\mid X=x)=0.70\), a nearest-neighbor label and a new case’s label are conditionally independent with that same probability. Calculate the nearest-neighbor population error and the error of always predicting 1. (Answer: Nearest-neighbor error \(=(0.70)(0.30)+(0.30)(0.70)=0.4200\); always predicting 1 has error 0.3000.)
  4. Two optimized classifier classes are nested, and the smaller class has minimum training error rate 0.18. What can be concluded about the larger class’s minimum training error, and what cannot be concluded about its validation error? (Answer: The larger class’s minimum training error is at most 0.18; no ordering of validation errors follows from nesting alone.)
  5. At a predictor value \(x\), \(P(Y=1\mid X=x)=0.35\). Find the conditional misclassification risks of predicting 0 and predicting 1, identify the lower-risk prediction, and state the minimum risk. (Answer: Predict 0 has risk 0.35; predict 1 has risk 0.65; predict 0 is preferred and the minimum conditional risk is 0.35.)
Clinical Biostats