Tutorials › Statistical Learning (Graduate) › Risk Bounds for Hard and Soft Thresholding

Adaptation and Honest Uncertainty · Tutorial 473 of 989

Risk Bounds for Hard and Soft Thresholding

Learn to calculate and bound hard- and soft-thresholding risk under Gaussian noise, distinguishing noise-driven errors at zero coordinates from shrinkage and missed-signal errors.

Advanced 12 min read

What You'll Learn

  • Write the exact coordinatewise squared-error risk for hard thresholding.
  • Separate false inclusions at zero coefficients from missed signals and selected noise.
  • Derive the soft-thresholding risk and understand its bounded shrinkage.
  • Prove a uniform soft-threshold risk bound using Gaussian integration by parts.
  • Compare the two rules through fully calculated Gaussian examples.

Why Separate the Sources of Thresholding Error?

Thresholding estimates many coefficients by setting small noisy observations to zero. This can remove noise when a true coefficient is zero, but it can also discard a real signal. If a coefficient survives thresholding, its estimate may still be inaccurate because of the noise; soft thresholding adds shrinkage even when the signal is retained. A useful risk calculation therefore distinguishes noise-driven error at zero coefficients from shrinkage and missed-signal error at nonzero coefficients.

We work coordinate by coordinate in the Gaussian sequence model. A vector estimate’s total squared-error risk is the sum of its coordinatewise risks, by additivity of expectation; independence between coordinates is not required for that identity. The calculations below help identify which part of the risk is controlled by thresholding and which part is paid for by shrinking or missing signals.

Definition: Let \(Y=\theta+\sigma Z\), where \(\theta\in\mathbb{R}\), \(\sigma>0\), and \(Z\sim N(0,1)\). For a threshold \(\lambda\geq 0\), define the hard- and soft-thresholding rules by $$ \eta_H(y;\lambda)=y\,\mathbf{1}\{|y|>\lambda\}, \qquad \eta_S(y;\lambda)=\operatorname{sgn}(y)(|y|-\lambda)_+, $$ where \(u_+=\max(u,0)\) and \(\operatorname{sgn}(0)=0\). Their coordinatewise squared-error risks are \(R_H(\theta)=E[(\eta_H(Y;\lambda)-\theta)^2]\) and \(R_S(\theta)=E[(\eta_S(Y;\lambda)-\theta)^2]\). Write \(\phi\) and \(\Phi\) for the standard normal density and distribution function, and \(\bar\Phi=1-\Phi\).

Hard Thresholding: Exact Risk and Its Two Components

Hard thresholding either keeps \(Y\) unchanged or replaces it by zero. Let \(A=\{|Y|>\lambda\}\) be the selection event. On \(A\), the estimation error is \(Y-\theta=\sigma Z\); on \(A^c\), it is \(-\theta\). Thus the exact risk decomposition is

$$ R_H(\theta) = \theta^2P(|Y|\leq\lambda) + \sigma^2E\!\left[Z^2\mathbf{1}\{|Y|>\lambda\}\right]. $$

The first term is the squared signal lost when the coefficient is thresholded to zero. The second is the noise error on the event that the coefficient is retained. At a zero coefficient the first term vanishes, and the remaining risk is exactly the cost of false inclusion.

$$ R_H(0) = 2\sigma^2\left\{t\phi(t)+\bar\Phi(t)\right\}, \qquad t=\lambda/\sigma. $$

To obtain this formula, use symmetry and the standard normal tail-moment identity \(\int_t^\infty z^2\phi(z)\,dz=t\phi(t)+\bar\Phi(t)\). This identity follows by integration by parts, since \(\phi'(z)=-z\phi(z)\).

Worked Example: False-Inclusion Risk at a Zero Coefficient

Take \(\sigma=1\), \(\lambda=2\), and \(\theta=0\). Hard thresholding has risk \(E[Z^2\mathbf{1}\{|Z|>2\}]\). Using \(\phi(2)\approx0.053990967\) and \(\bar\Phi(2)\approx0.022750132\),

$$ R_H(0)=2\{2\phi(2)+\bar\Phi(2)\} \approx2(0.107981934+0.022750132) \approx0.261464. $$

The estimate is wrong only when noise pushes the observation outside \([-2,2]\), but on those occasions the retained noise can be substantial. The risk is the second moment of the noise on that tail event, not merely the probability of selection.

Hard-Thresholding Bounds for Nonzero Signals

For a nonzero coefficient, the exact decomposition immediately gives useful bounds. If \(|\theta|>\lambda\), thresholding can miss the signal only when the noise moves \(Y\) toward or across the threshold. By symmetry, the probability of this event is at most \(\Phi((\lambda-|\theta|)/\sigma)\). Also, the selected-noise contribution is at most \(E[\sigma^2Z^2]=\sigma^2\). Therefore

Hard-threshold bound for a signal: If \(|\theta|>\lambda\), then $$ R_H(\theta) \leq \theta^2\Phi\!\left(\frac{\lambda-|\theta|}{\sigma}\right)+\sigma^2. $$ The first term bounds missed-signal error; the second bounds noise error when selected.

For \(\theta>0\), the event \(|Y|\leq\lambda\) implies \(Z\leq(\lambda-\theta)/\sigma\), so its probability is at most that normal lower-tail probability. For \(\theta<0\), apply the same argument to \(-Y\). This proves the claimed miss-probability bound. When \(|\theta|\leq\lambda\), the general decomposition still applies, but the signal is not separated from the threshold by a positive margin; a simple bound is \(R_H(\theta)\leq\theta^2+\sigma^2\).

Worked Example: Exact Hard-Threshold Risk for a Signal

Let \(\sigma=1\), \(\lambda=2\), and \(\theta=1\). The coefficient is rejected when \(-2\leq Y\leq2\), equivalently \(-3\leq Z\leq1\). Thus the missed-signal contribution is

$$ \theta^2P(|Y|\leq2) =\Phi(1)-\Phi(-3) \approx0.841344746-0.001349898 =0.839994848. $$

When selected, \(Z>1\) or \(Z<-3\). The selected-noise contribution is

$$ \begin{aligned} E[Z^2\mathbf{1}\{Z>1\text{ or }Z<-3\}] &=\phi(1)+\bar\Phi(1)+3\phi(3)+\bar\Phi(3)\\ &\approx0.241971+0.158655+0.013296+0.001350\\ &\approx0.415271. \end{aligned} $$

Here the tail-moment identity is used on each side, with symmetry for the lower tail. Adding the two contributions gives \(R_H(1)\approx0.415271421+0.839994848=1.255266270\), or approximately \(1.255266\). The large missed-signal term reflects that the signal \(1\) lies below the threshold \(2\).

Soft Thresholding: Shrinkage and a Uniform Risk Bound

Soft thresholding also sets observations inside \([-\lambda,\lambda]\) to zero, but outside that interval it moves the observation \(\lambda\) units toward zero. Define \(A=\{|Y|>\lambda\}\). On \(A^c\), the squared error is \(\theta^2\). On \(A\), the error is \(\sigma Z-\lambda\operatorname{sgn}(Y)\). This gives the exact decomposition

$$ R_S(\theta) = \theta^2P(|Y|\leq\lambda) + E\!\left[ \{\sigma Z-\lambda\operatorname{sgn}(Y)\}^2 \mathbf{1}\{|Y|>\lambda\} \right]. $$

For \(\theta=0\), symmetry and integration of \((z-\lambda/\sigma)^2\) over the upper tail give the exact expression below. For nonzero \(\theta\), the formula separates the squared error from rejecting the coefficient and the error—including shrinkage—when it is retained.

$$ R_S(0) = 2\sigma^2\left\{(1+t^2)\bar\Phi(t)-t\phi(t)\right\}, \qquad t=\lambda/\sigma. $$

Worked Example: Soft-Threshold Risk at a Zero Coefficient

Again take \(\sigma=1\), \(\lambda=2\), and \(\theta=0\). On the event \(Z>2\), the estimate is \(Z-2\); the negative tail contributes the same risk. Therefore

$$ \begin{aligned} R_S(0) &=2\int_2^\infty(z-2)^2\phi(z)\,dz\\ &=2\{(1+2^2)\bar\Phi(2)-2\phi(2)\}\\ &\approx2\{5(0.022750132)-2(0.053990967)\}\\ &\approx0.011537. \end{aligned} $$

The integral expansion uses \(\int_2^\infty z\phi(z)\,dz=\phi(2)\) and \(\int_2^\infty z^2\phi(z)\,dz=2\phi(2)+\bar\Phi(2)\). The soft rule’s false-inclusion error is small here because even selected observations are pulled toward zero.

Theorem: For every \(\theta\in\mathbb{R}\), \(\sigma>0\), and \(\lambda\geq0\), soft thresholding satisfies $$ R_S(\theta)\leq \sigma^2+\lambda^2. $$

Proof. Write \(\delta(y)=\eta_S(y;\lambda)\). The function \(\delta\) is absolutely continuous, has at most linear growth, and has derivative \(\delta'(y)=\mathbf{1}\{|y|>\lambda\}\) except at the two threshold points, which have probability zero under a Gaussian distribution. Expanding the squared error and applying integration by parts to the Gaussian density gives

$$ \begin{aligned} E[(\delta(Y)-\theta)^2] &=E[(\delta(Y)-Y)^2]+2E[(\delta(Y)-Y)(Y-\theta)]+E[(Y-\theta)^2]\\ &=E[(\delta(Y)-Y)^2]+2\sigma^2E[\delta'(Y)]-\sigma^2. \end{aligned} $$

For the second equality, Gaussian integration by parts states \(E[(Y-\theta)g(Y)]=\sigma^2E[g'(Y)]\) for absolutely continuous \(g\) of suitable integrability. Apply it to \(g(y)=\delta(y)-y\), whose derivative is bounded almost everywhere. Since \(\delta(y)-y\) is the amount removed from \(y\), its magnitude is at most \(\lambda\). Also \(E[\delta'(Y)]\leq1\). Consequently,

$$ R_S(\theta) \leq \lambda^2+2\sigma^2-\sigma^2 =\lambda^2+\sigma^2. $$

All expectations in this calculation are finite because \(\delta\) has at most linear growth and \(Y\) is Gaussian. This proves the bound. \(\square\)

Comparing the Rules on a Strong Signal

For a signal well above the threshold, hard thresholding has no systematic shrinkage when it selects the coefficient; its main extra risk is the rare event that noise pushes the observation below threshold. Soft thresholding avoids a discontinuous jump at the threshold, but on a strong positive signal its estimate is approximately \(Y-\lambda\), so it incurs a shrinkage error of approximately \(\lambda^2\) in addition to noise variance. The following example shows both effects through the exact event decomposition.

Worked Example: A Signal Well Above the Threshold

Take \(\sigma=1\), \(\lambda=2\), and \(\theta=4\). For hard thresholding, rejection means \(-6\leq Z\leq-2\), with probability \(\Phi(-2)-\Phi(-6)\). Hence

$$ R_H(4) =16\{\Phi(-2)-\Phi(-6)\} +E[Z^2\mathbf{1}\{Z> -2\text{ or }Z<-6\}]. $$

The missed-signal term is \(16(0.022750132-0.000000001)\approx0.364002\). The selected-noise term is at most \(E[Z^2]=1\), so \(R_H(4)\leq1.364003\). This bound retains the two distinct costs: a small chance of losing the signal and at most one unit of selected-noise risk.

For soft thresholding the exact decomposition has \(a=-6\) and \(b=-2\). Its rejection contribution is the same, \(16\{\Phi(-2)-\Phi(-6)\}\). On the left selected tail the estimate is \(Y+2\), and on the right selected tail it is \(Y-2\), giving

$$ \begin{aligned} R_S(4) ={}&16\{\Phi(-2)-\Phi(-6)\}\\ &+\{5\Phi(-6)+2\phi(6)\} +\{5\Phi(2)-6\phi(2)\}\\ \approx{}&0.364002+0.000000017+4.562304\\ \approx{}&4.926306. \end{aligned} $$

For example, the right-tail integral is \(\int_{-2}^\infty(z-2)^2\phi(z)\,dz=5\Phi(2)-6\phi(2)\); the left-tail integral is \(\int_{-\infty}^{-6}(z+2)^2\phi(z)\,dz=5\Phi(-6)+2\phi(6)\). The soft-threshold risk is larger here because the retained estimate is pulled two units toward zero. This is not a contradiction of its uniform bound: that bound is \(\sigma^2+\lambda^2=5\), which the calculated risk satisfies.

Common Pitfall and Practical Interpretation

A common mistake is to count only the probability that a coefficient is selected and call that the risk at a zero coefficient. Risk is expected squared error, not selection probability. At \(\theta=0\), hard thresholding’s risk is \(E[Y^2\mathbf{1}\{|Y|>\lambda\}]\), which weights a false inclusion by its squared magnitude. Soft thresholding instead weights the selected observation by \((|Y|-\lambda)^2\). Confusing these quantities can badly misstate the cost of thresholding.

For nonzero coefficients, it is equally important not to treat the thresholded estimate as if selection were certain. The exact decompositions include a missed-signal term \(\theta^2P(|Y|\leq\lambda)\); omitting it is particularly serious when \(|\theta|\) is near or below \(\lambda\). Conversely, a signal far above threshold has a small miss probability, and the main difference between the rules is then hard thresholding’s retained noise versus soft thresholding’s shrinkage. These coordinatewise bounds can be summed across a sequence to study total squared-error risk.

Check Your Understanding

Use the event decompositions and Gaussian tail identities to answer the following.

  1. For hard thresholding, identify the two terms in the risk when \(\theta\neq0\), and explain what each measures.
  2. Why is hard-threshold risk at \(\theta=0\) not equal to \(P(|Y|>\lambda)\)?
  3. In the hard-threshold signal bound, what happens to the missed-signal term as \(|\theta|-\lambda\) becomes large relative to \(\sigma\)?
  4. Explain why soft thresholding’s error on a selected observation contains a shrinkage term as well as Gaussian noise.
  5. For \(\sigma=1\), \(\lambda=1\), and \(\theta=0\), write the exact formula for soft-threshold risk using \(\phi\) and \(\bar\Phi\).
Clinical Biostats