Tutorials › Statistical Learning (Graduate) › Boundary Mass Versus Class Imbalance

Plug-In Classification and Margins · Tutorial 513 of 989

Boundary Mass Versus Class Imbalance

Learn to distinguish class prevalence from boundary mass and verify how the latter can change while prevalence stays fixed.

Intermediate 9 min read

What You'll Learn

  • Define class prevalence as the mean of the regression function.
  • Define probability mass within a chosen distance of the Bayes boundary.
  • Compute both quantities from finite-support binary distributions.
  • Compare models with identical prevalence but different boundary mass.
  • Identify why class proportions alone cannot establish a margin condition.

Two Different Questions About a Binary Distribution

In binary classification, the proportion of observations in each class and the amount of feature probability near the Bayes decision boundary are related to different aspects of the joint distribution. Class proportions describe how often each label occurs overall. Boundary mass describes how much probability the feature distribution assigns to locations where the conditional class probability is close to one half. One quantity cannot, in general, be read off from the other.

Let \(Y\in\{0,1\}\) be a binary response and \(X\) a feature vector. Write \(\eta(x)=P(Y=1\mid X=x)\) for the regression function. The Bayes rule assigns class 1 when \(\eta(x)>1/2\), and class 0 when \(\eta(x)<1/2\); either choice has the same conditional error when \(\eta(x)=1/2\). The feature points with \(\eta(x)=1/2\) form the decision-boundary score set. The probability mass near that set depends both on \(\eta\) and on the distribution of \(X\).

Definition: The class prevalence is \(\pi=P(Y=1)\). The boundary-neighborhood mass at radius \(t\geq 0\) is $$ M(t)=P\left(\left|\eta(X)-\frac12\right|\leq t\right). $$ It is the feature probability assigned to points whose conditional class probability is within \(t\) of one half. In particular, \(M(0)=P(\eta(X)=1/2)\). This is a probability under the distribution of \(X\), not a proportion of feature space measured by its geometric size.

Prevalence Is a Mean, Not a Boundary-Mass Summary

Proposition: For a binary response and a measurable regression function \(\eta(X)=P(Y=1\mid X)\), the prevalence satisfies \(\pi=E[\eta(X)]\).

Proof. Since \(Y\) is binary, \(E[Y]=P(Y=1)=\pi\). By the defining property of conditional expectation, \(E[Y\mid X]=P(Y=1\mid X)=\eta(X)\). The law of total expectation therefore gives

$$ \pi=E[Y]=E\{E[Y\mid X]\}=E[\eta(X)]. $$

Thus prevalence fixes the average value of \(\eta(X)\). By contrast, \(M(t)\) counts the probability that \(\eta(X)\) falls in a particular interval around \(1/2\). Knowing an average does not generally specify how much probability lies in that interval.

Worked Example: Same Prevalence, Different Mass Near the Boundary

Consider two binary distributions and calculate their prevalence and boundary-neighborhood mass at \(t=0.02\).

Distribution A. Let \(X\) take values \(a\) and \(b\), with \(P(X=a)=1/3\), \(P(X=b)=2/3\), \(\eta(a)=0.2\), and \(\eta(b)=0.8\). Specify \(Y\mid X=x\) to be Bernoulli with success probability \(\eta(x)\). Then

$$ \pi_A=E[\eta(X)] =\frac13(0.2)+\frac23(0.8) =\frac{0.2}{3}+\frac{1.6}{3} =\frac{1.8}{3} =0.6. $$

The two distances from one half are \(|0.2-0.5|=0.3\) and \(|0.8-0.5|=0.3\). Neither is at most \(0.02\), so \(M_A(0.02)=0\).

Distribution B. Let \(X\) take values \(c\) and \(d\), each with probability \(1/2\), and set \(\eta(c)=0.49\), \(\eta(d)=0.71\). Its prevalence is

$$ \pi_B=\frac12(0.49)+\frac12(0.71) =\frac{0.49+0.71}{2} =\frac{1.20}{2} =0.6. $$

Here the distances from one half are \(0.01\) and \(0.21\). Only \(c\) is within \(0.02\), giving \(M_B(0.02)=P(X=c)=1/2\). Both distributions have prevalence \(0.6\), but their boundary-neighborhood masses are \(0\) and \(1/2\).

This comparison establishes the central point directly: the same class prevalence is compatible with different amounts of feature probability near the boundary. The difference is not caused by an arithmetic convention. It is a difference in how the distribution of \(\eta(X)\) is spread around its mean.

Changing Boundary Mass While Holding the Mean Fixed

Worked Example: A Single Conditional Probability Versus a Split Distribution

Suppose first that \(X\) has one possible value \(x_0\), with \(\eta(x_0)=0.6\). Then \(\pi=E[\eta(X)]=0.6\). At \(t=0.1\), the only feature value has distance \(|0.6-0.5|=0.1\), so the inclusive inequality in the definition gives \(M(0.1)=1\).

Now use Distribution A from the previous example. Its prevalence is also \(0.6\), but both possible feature values have distance \(0.3\) from one half. Since \(0.3>0.1\), its boundary-neighborhood mass is \(M(0.1)=0\). A single point at the mean and a distribution split on either side of the mean can have the same prevalence and radically different mass near the boundary.

The feature probabilities matter as well as the conditional probabilities. In a finite-support model with feature values \(x_1,\ldots,x_k\), write \(w_j=P(X=x_j)\) and \(\eta_j=\eta(x_j)\), where \(w_j\geq0\) and \(\sum_{j=1}^k w_j=1\). Then the two quantities are

$$ \pi=\sum_{j=1}^k w_j\eta_j, \qquad M(t)=\sum_{j=1}^k w_j\,\mathbf{1}\left\{\left|\eta_j-\frac12\right|\leq t\right\}. $$

The first expression weights each conditional probability by its feature probability. The second sums the weights only for feature values in the specified boundary neighborhood. Holding the first weighted sum fixed need not hold the second fixed.

Proposition: Class prevalence alone does not determine \(M(t)\). In particular, there exist binary distributions with the same prevalence and different boundary-neighborhood mass at the same radius.

Proof. Take the two distributions in the first worked example. In each, \(Y\mid X=x\) is Bernoulli with success probability \(\eta(x)\), so both are valid binary distributions. The calculations there give \(\pi_A=\pi_B=0.6\). At \(t=0.02\), Distribution A has no feature values with \(|\eta(x)-1/2|\leq0.02\), while Distribution B assigns probability \(1/2\) to a feature value with distance \(0.01\). Therefore \(M_A(0.02)=0\) and \(M_B(0.02)=1/2\), proving the claim. \(\square\)

Worked Example: Tuning Boundary Mass at Fixed Prevalence

A family of finite-support models makes it possible to vary boundary mass continuously while keeping prevalence at \(0.6\). Let \(P(X=a)=q\) and \(P(X=b)=1-q\), with \(\eta(a)=0.5\). Choose \(\eta(b)=r\) so that the prevalence remains \(0.6\). Solving the mean equation gives

$$ q(0.5)+(1-q)r=0.6, \qquad r=\frac{0.6-0.5q}{1-q},\quad q<1. $$

For a concrete choice, let \(q=0.4\). Then

$$ r=\frac{0.6-0.5(0.4)}{1-0.4} =\frac{0.6-0.2}{0.6} =\frac{0.4}{0.6} =\frac23. $$

The prevalence checks exactly:

$$ E[\eta(X)]=(0.4)(0.5)+(0.6)\left(\frac23\right) =0.2+0.4=0.6. $$

At \(t=0.01\), the feature value \(a\) is exactly on the boundary and contributes probability \(0.4\). The other value has distance \(|2/3-1/2|=1/6\), which is greater than \(0.01\). Hence \(M(0.01)=0.4\).

More generally, for \(0\leq q\leq0.8\), the displayed value of \(r\) lies in \([0,1]\), so it defines a valid conditional probability. Indeed, \(r\geq0\) because \(0.6-0.5q\geq0\), and \(r\leq1\) is equivalent to \(0.6-0.5q\leq1-q\), or \(q\leq0.8\). For any \(t<1/6\), the point \(b\) is outside the neighborhood, while \(a\) is inside it, so \(M(t)=q\). The boundary mass can therefore vary with \(q\) across this range without changing prevalence.

Why the Distinction Matters

A class-imbalance summary such as \(\pi=0.6\) says that positive labels occur with probability \(0.6\) overall. It does not say whether many feature values have conditional class probabilities close to one half, whether the conditional probabilities are mostly far from one half, or how feature probability is distributed across those values. These distinctions matter when interpreting assumptions or diagnostics about examples near the Bayes boundary.

In particular, a margin condition concerns the behavior of \(M(t)\) as \(t\) varies, not merely the marginal distribution of \(Y\). Two data-generating distributions with the same positive-label proportion can therefore have very different boundary-neighborhood mass. Prevalence may be useful descriptive information, but it cannot certify a particular margin behavior.

Common Pitfall

Wrong reasoning: “The positive class has prevalence \(0.6\), so the regression function must put a fixed amount of mass near \(1/2\).” This treats the average \(E[\eta(X)]\) as if it determined the distribution of \(\eta(X)\). The examples show that it does not.

Correction: Calculate prevalence by averaging \(\eta(X)\), but calculate boundary mass by summing or integrating feature probability over the event \(\{|\eta(X)-1/2|\leq t\}\). These are different calculations. To assess boundary mass, information about both \(\eta\) and the distribution of \(X\) is needed.

Key takeaway: Class prevalence is the mean of the regression function; boundary-neighborhood mass is the probability that the regression function lies close to one half. Equal means do not imply equal probability mass near the Bayes decision boundary.

Check Your Understanding

Use the definitions and calculations in this tutorial to answer the following.

  1. For a binary response, why is the prevalence equal to \(E[\eta(X)]\)? State the conditional-expectation identity used.
  2. In Distribution A, what are the two possible values of \(|\eta(X)-1/2|\), and why is \(M_A(0.02)=0\)?
  3. In Distribution B, compute the feature probability included in \(M_B(0.02)\). Why does it differ from Distribution A despite equal prevalence?
  4. For the model with \(P(X=a)=0.4\), \(\eta(a)=0.5\), and \(\eta(b)=2/3\), verify the prevalence and find \(M(0.01)\).
  5. In one sentence, explain why a reported class proportion cannot by itself establish the amount of data near the Bayes boundary.
Clinical Biostats