SDSC6001 Assignment 1: Covering-Number Generalization Bound
Problem: Prove a covering-number bound and verify it by simulation
Background (given)
Let H \mathcal{H} H be a family of functions mapping X \mathcal{X} X to Y ⊆ R \mathcal{Y} \subseteq \mathbb{R} Y ⊆ R . We consider the squared loss
ℓ ( h ( x ) , y ) = ( h ( x ) − y ) 2 \ell(h(x), y) = (h(x) - y)^2
ℓ ( h ( x ) , y ) = ( h ( x ) − y ) 2
Let D D D be an unknown distribution over X × Y \mathcal{X} \times \mathcal{Y} X × Y . For h ∈ H h \in \mathcal{H} h ∈ H , define the true risk and empirical risk:
R ( h ) = E ( x , y ) ∼ D [ ( h ( x ) − y ) 2 ] , R ^ S ( h ) = 1 m ∑ i = 1 m ( h ( x i ) − y i ) 2 R(h) = \mathbb{E}_{(x,y)\sim D}[(h(x) - y)^2], \quad \hat{R}_S(h) = \frac{1}{m}\sum_{i=1}^{m}(h(x_i) - y_i)^2
R ( h ) = E ( x , y ) ∼ D [( h ( x ) − y ) 2 ] , R ^ S ( h ) = m 1 i = 1 ∑ m ( h ( x i ) − y i ) 2
where S = ( ( x 1 , y 1 ) , … , ( x m , y m ) ) ∼ D m S = ((x_1, y_1), \ldots, (x_m, y_m)) \sim D^m S = (( x 1 , y 1 ) , … , ( x m , y m )) ∼ D m is an i.i.d. sample.
Assume H \mathcal{H} H is bounded : there exists M > 0 M > 0 M > 0 such that
∣ h ( x ) − y ∣ ≤ M for all ( x , y ) ∈ X × Y and all h ∈ H |h(x) - y| \leq M \quad \text{for all } (x, y) \in \mathcal{X} \times \mathcal{Y} \text{ and all } h \in \mathcal{H}
∣ h ( x ) − y ∣ ≤ M for all ( x , y ) ∈ X × Y and all h ∈ H
Covering number (sup norm). For ε > 0 \varepsilon > 0 ε > 0 , the covering number N ( H , ε ) \mathcal{N}(\mathcal{H}, \varepsilon) N ( H , ε ) under ∥ ⋅ ∥ ∞ \|\cdot\|_\infty ∥ ⋅ ∥ ∞ is the smallest k k k such that there exist h 1 , … , h k ∈ H h_1, \ldots, h_k \in \mathcal{H} h 1 , … , h k ∈ H satisfying: for every h ∈ H h \in \mathcal{H} h ∈ H , there exists i ≤ k i \leq k i ≤ k with
∥ h − h i ∥ ∞ = sup x ∈ X ∣ h ( x ) − h i ( x ) ∣ ≤ ε \|h - h_i\|_\infty = \sup_{x \in \mathcal{X}} |h(x) - h_i(x)| \leq \varepsilon
∥ h − h i ∥ ∞ = x ∈ X sup ∣ h ( x ) − h i ( x ) ∣ ≤ ε
Similar to VC dimension, covering numbers provides a measurement of complexity of a class of functions: the larger the covering number, the richer is the family of functions. The objective of this problem is to illustrate this by proving a learning bound in the case of the squared loss.
Target bound (to prove)
Prove the following generalization bound:
P S ∼ D m [ sup h ∈ H ∣ R ( h ) − R ^ S ( h ) ∣ ≥ ε ] ≤ N ( H , ε 8 M ) ⋅ 2 exp ( − m ε 2 2 M 4 ) ( ⋆ ) \mathbb{P}_{S\sim D^m}\left[\sup_{h\in\mathcal{H}}|R(h) - \hat{R}_S(h)| \geq \varepsilon\right] \leq \mathcal{N}\left(\mathcal{H}, \frac{\varepsilon}{8M}\right) \cdot 2\exp\left(-\frac{m\varepsilon^2}{2M^4}\right) \quad (\star)
P S ∼ D m [ h ∈ H sup ∣ R ( h ) − R ^ S ( h ) ∣ ≥ ε ] ≤ N ( H , 8 M ε ) ⋅ 2 exp ( − 2 M 4 m ε 2 ) ( ⋆ )
Part I: Proof
Let L S ( h ) = R ( h ) − R ^ S ( h ) L_S(h) = R(h) - \hat{R}_S(h) L S ( h ) = R ( h ) − R ^ S ( h ) .
Problem 1 (20%): Lipschitz step
Problem Statement: Show that for all h 1 , h 2 ∈ H h_1, h_2 \in \mathcal{H} h 1 , h 2 ∈ H and any sample S S S ,
∣ L S ( h 1 ) − L S ( h 2 ) ∣ ≤ 4 M ∥ h 1 − h 2 ∥ ∞ |L_S(h_1) - L_S(h_2)| \leq 4M \|h_1 - h_2\|_\infty
∣ L S ( h 1 ) − L S ( h 2 ) ∣ ≤ 4 M ∥ h 1 − h 2 ∥ ∞
Hint: Use a 2 − b 2 = ( a − b ) ( a + b ) a^2 - b^2 = (a-b)(a+b) a 2 − b 2 = ( a − b ) ( a + b ) and boundedness by M M M .
Proof:
First, we analyze the Lipschitz property of R ( h ) R(h) R ( h ) and R ^ S ( h ) \hat{R}_S(h) R ^ S ( h ) with respect to h h h separately.
Step 1: Analyze ∣ R ( h 1 ) − R ( h 2 ) ∣ |R(h_1) - R(h_2)| ∣ R ( h 1 ) − R ( h 2 ) ∣
R ( h 1 ) − R ( h 2 ) = E ( x , y ) ∼ D [ ( h 1 ( x ) − y ) 2 − ( h 2 ( x ) − y ) 2 ] R(h_1) - R(h_2) = \mathbb{E}_{(x,y)\sim D}[(h_1(x) - y)^2 - (h_2(x) - y)^2]
R ( h 1 ) − R ( h 2 ) = E ( x , y ) ∼ D [( h 1 ( x ) − y ) 2 − ( h 2 ( x ) − y ) 2 ]
Using the identity a 2 − b 2 = ( a − b ) ( a + b ) a^2 - b^2 = (a-b)(a+b) a 2 − b 2 = ( a − b ) ( a + b ) , let a = h 1 ( x ) − y a = h_1(x) - y a = h 1 ( x ) − y and b = h 2 ( x ) − y b = h_2(x) - y b = h 2 ( x ) − y :
( h 1 ( x ) − y ) 2 − ( h 2 ( x ) − y ) 2 = ( h 1 ( x ) − h 2 ( x ) ) ( ( h 1 ( x ) − y ) + ( h 2 ( x ) − y ) ) (h_1(x) - y)^2 - (h_2(x) - y)^2 = (h_1(x) - h_2(x))((h_1(x) - y) + (h_2(x) - y))
( h 1 ( x ) − y ) 2 − ( h 2 ( x ) − y ) 2 = ( h 1 ( x ) − h 2 ( x )) (( h 1 ( x ) − y ) + ( h 2 ( x ) − y ))
Therefore:
∣ R ( h 1 ) − R ( h 2 ) ∣ = ∣ E ( x , y ) ∼ D [ ( h 1 ( x ) − h 2 ( x ) ) ( ( h 1 ( x ) − y ) + ( h 2 ( x ) − y ) ) ] ∣ |R(h_1) - R(h_2)| = \left|\mathbb{E}_{(x,y)\sim D}[(h_1(x) - h_2(x))((h_1(x) - y) + (h_2(x) - y))]\right|
∣ R ( h 1 ) − R ( h 2 ) ∣ = E ( x , y ) ∼ D [( h 1 ( x ) − h 2 ( x )) (( h 1 ( x ) − y ) + ( h 2 ( x ) − y ))]
By the boundedness assumption ∣ h i ( x ) − y ∣ ≤ M |h_i(x) - y| \leq M ∣ h i ( x ) − y ∣ ≤ M , we have:
∣ h 1 ( x ) − h 2 ( x ) ∣ ≤ ∥ h 1 − h 2 ∥ ∞ |h_1(x) - h_2(x)| \leq \|h_1 - h_2\|_\infty ∣ h 1 ( x ) − h 2 ( x ) ∣ ≤ ∥ h 1 − h 2 ∥ ∞
∣ ( h 1 ( x ) − y ) + ( h 2 ( x ) − y ) ∣ ≤ ∣ h 1 ( x ) − y ∣ + ∣ h 2 ( x ) − y ∣ ≤ 2 M |(h_1(x) - y) + (h_2(x) - y)| \leq |h_1(x) - y| + |h_2(x) - y| \leq 2M ∣ ( h 1 ( x ) − y ) + ( h 2 ( x ) − y ) ∣ ≤ ∣ h 1 ( x ) − y ∣ + ∣ h 2 ( x ) − y ∣ ≤ 2 M
Therefore:
∣ R ( h 1 ) − R ( h 2 ) ∣ ≤ E [ ∥ h 1 − h 2 ∥ ∞ ⋅ 2 M ] = 2 M ∥ h 1 − h 2 ∥ ∞ |R(h_1) - R(h_2)| \leq \mathbb{E}[\|h_1 - h_2\|_\infty \cdot 2M] = 2M\|h_1 - h_2\|_\infty
∣ R ( h 1 ) − R ( h 2 ) ∣ ≤ E [ ∥ h 1 − h 2 ∥ ∞ ⋅ 2 M ] = 2 M ∥ h 1 − h 2 ∥ ∞
Step 2: Analyze ∣ R ^ S ( h 1 ) − R ^ S ( h 2 ) ∣ |\hat{R}_S(h_1) - \hat{R}_S(h_2)| ∣ R ^ S ( h 1 ) − R ^ S ( h 2 ) ∣
R ^ S ( h 1 ) − R ^ S ( h 2 ) = 1 m ∑ i = 1 m [ ( h 1 ( x i ) − y i ) 2 − ( h 2 ( x i ) − y i ) 2 ] \hat{R}_S(h_1) - \hat{R}_S(h_2) = \frac{1}{m}\sum_{i=1}^{m}[(h_1(x_i) - y_i)^2 - (h_2(x_i) - y_i)^2]
R ^ S ( h 1 ) − R ^ S ( h 2 ) = m 1 i = 1 ∑ m [( h 1 ( x i ) − y i ) 2 − ( h 2 ( x i ) − y i ) 2 ]
Similarly using a 2 − b 2 = ( a − b ) ( a + b ) a^2 - b^2 = (a-b)(a+b) a 2 − b 2 = ( a − b ) ( a + b ) :
= 1 m ∑ i = 1 m ( h 1 ( x i ) − h 2 ( x i ) ) ( ( h 1 ( x i ) − y i ) + ( h 2 ( x i ) − y i ) ) = \frac{1}{m}\sum_{i=1}^{m}(h_1(x_i) - h_2(x_i))((h_1(x_i) - y_i) + (h_2(x_i) - y_i))
= m 1 i = 1 ∑ m ( h 1 ( x i ) − h 2 ( x i )) (( h 1 ( x i ) − y i ) + ( h 2 ( x i ) − y i ))
Taking absolute value:
∣ R ^ S ( h 1 ) − R ^ S ( h 2 ) ∣ ≤ 1 m ∑ i = 1 m ∣ h 1 ( x i ) − h 2 ( x i ) ∣ ⋅ 2 M |\hat{R}_S(h_1) - \hat{R}_S(h_2)| \leq \frac{1}{m}\sum_{i=1}^{m}|h_1(x_i) - h_2(x_i)| \cdot 2M
∣ R ^ S ( h 1 ) − R ^ S ( h 2 ) ∣ ≤ m 1 i = 1 ∑ m ∣ h 1 ( x i ) − h 2 ( x i ) ∣ ⋅ 2 M
≤ 1 m ∑ i = 1 m ∥ h 1 − h 2 ∥ ∞ ⋅ 2 M = 2 M ∥ h 1 − h 2 ∥ ∞ \leq \frac{1}{m}\sum_{i=1}^{m}\|h_1 - h_2\|_\infty \cdot 2M = 2M\|h_1 - h_2\|_\infty
≤ m 1 i = 1 ∑ m ∥ h 1 − h 2 ∥ ∞ ⋅ 2 M = 2 M ∥ h 1 − h 2 ∥ ∞
Step 3: Combine the results
∣ L S ( h 1 ) − L S ( h 2 ) ∣ = ∣ R ( h 1 ) − R ^ S ( h 1 ) − R ( h 2 ) + R ^ S ( h 2 ) ∣ |L_S(h_1) - L_S(h_2)| = |R(h_1) - \hat{R}_S(h_1) - R(h_2) + \hat{R}_S(h_2)|
∣ L S ( h 1 ) − L S ( h 2 ) ∣ = ∣ R ( h 1 ) − R ^ S ( h 1 ) − R ( h 2 ) + R ^ S ( h 2 ) ∣
≤ ∣ R ( h 1 ) − R ( h 2 ) ∣ + ∣ R ^ S ( h 1 ) − R ^ S ( h 2 ) ∣ \leq |R(h_1) - R(h_2)| + |\hat{R}_S(h_1) - \hat{R}_S(h_2)|
≤ ∣ R ( h 1 ) − R ( h 2 ) ∣ + ∣ R ^ S ( h 1 ) − R ^ S ( h 2 ) ∣
≤ 2 M ∥ h 1 − h 2 ∥ ∞ + 2 M ∥ h 1 − h 2 ∥ ∞ = 4 M ∥ h 1 − h 2 ∥ ∞ \leq 2M\|h_1 - h_2\|_\infty + 2M\|h_1 - h_2\|_\infty = 4M\|h_1 - h_2\|_\infty
≤ 2 M ∥ h 1 − h 2 ∥ ∞ + 2 M ∥ h 1 − h 2 ∥ ∞ = 4 M ∥ h 1 − h 2 ∥ ∞
Problem 2 (15%): Union bound over a cover
Problem Statement: If H = ⋃ i = 1 k B i \mathcal{H} = \bigcup_{i=1}^{k} B_i H = ⋃ i = 1 k B i , show that
P [ sup h ∈ H ∣ L S ( h ) ∣ ≥ ε ] ≤ ∑ i = 1 k P [ sup h ∈ B i ∣ L S ( h ) ∣ ≥ ε ] \mathbb{P}\left[\sup_{h\in\mathcal{H}}|L_S(h)| \geq \varepsilon\right] \leq \sum_{i=1}^{k}\mathbb{P}\left[\sup_{h\in B_i}|L_S(h)| \geq \varepsilon\right]
P [ h ∈ H sup ∣ L S ( h ) ∣ ≥ ε ] ≤ i = 1 ∑ k P [ h ∈ B i sup ∣ L S ( h ) ∣ ≥ ε ]
Proof:
Define event A = { sup h ∈ H ∣ L S ( h ) ∣ ≥ ε } A = \{\sup_{h\in\mathcal{H}}|L_S(h)| \geq \varepsilon\} A = { sup h ∈ H ∣ L S ( h ) ∣ ≥ ε } and A i = { sup h ∈ B i ∣ L S ( h ) ∣ ≥ ε } A_i = \{\sup_{h\in B_i}|L_S(h)| \geq \varepsilon\} A i = { sup h ∈ B i ∣ L S ( h ) ∣ ≥ ε } .
Step 1: Show that A ⊆ ⋃ i = 1 k A i A \subseteq \bigcup_{i=1}^{k} A_i A ⊆ ⋃ i = 1 k A i
Suppose event A A A occurs, i.e., there exists h ∗ ∈ H h^* \in \mathcal{H} h ∗ ∈ H such that ∣ L S ( h ∗ ) ∣ ≥ ε |L_S(h^*)| \geq \varepsilon ∣ L S ( h ∗ ) ∣ ≥ ε .
Since H = ⋃ i = 1 k B i \mathcal{H} = \bigcup_{i=1}^{k} B_i H = ⋃ i = 1 k B i , there exists some j ∈ { 1 , … , k } j \in \{1, \ldots, k\} j ∈ { 1 , … , k } such that h ∗ ∈ B j h^* \in B_j h ∗ ∈ B j .
Therefore sup h ∈ B j ∣ L S ( h ) ∣ ≥ ∣ L S ( h ∗ ) ∣ ≥ ε \sup_{h\in B_j}|L_S(h)| \geq |L_S(h^*)| \geq \varepsilon sup h ∈ B j ∣ L S ( h ) ∣ ≥ ∣ L S ( h ∗ ) ∣ ≥ ε , which means A j A_j A j occurs.
So A ⊆ ⋃ i = 1 k A i A \subseteq \bigcup_{i=1}^{k} A_i A ⊆ ⋃ i = 1 k A i .
Step 2: Apply the union bound
By monotonicity of probability and the union bound:
P [ A ] ≤ P [ ⋃ i = 1 k A i ] ≤ ∑ i = 1 k P [ A i ] \mathbb{P}[A] \leq \mathbb{P}\left[\bigcup_{i=1}^{k} A_i\right] \leq \sum_{i=1}^{k}\mathbb{P}[A_i]
P [ A ] ≤ P [ i = 1 ⋃ k A i ] ≤ i = 1 ∑ k P [ A i ]
That is:
P [ sup h ∈ H ∣ L S ( h ) ∣ ≥ ε ] ≤ ∑ i = 1 k P [ sup h ∈ B i ∣ L S ( h ) ∣ ≥ ε ] \mathbb{P}\left[\sup_{h\in\mathcal{H}}|L_S(h)| \geq \varepsilon\right] \leq \sum_{i=1}^{k}\mathbb{P}\left[\sup_{h\in B_i}|L_S(h)| \geq \varepsilon\right]
P [ h ∈ H sup ∣ L S ( h ) ∣ ≥ ε ] ≤ i = 1 ∑ k P [ h ∈ B i sup ∣ L S ( h ) ∣ ≥ ε ]
Problem 3 (25%): From cover to finite set + concentration
Problem Statement: Let k = N ( H , ε / ( 8 M ) ) k = \mathcal{N}(\mathcal{H}, \varepsilon/(8M)) k = N ( H , ε / ( 8 M )) , and let h 1 , … , h k h_1, \ldots, h_k h 1 , … , h k be centers of ∥ ⋅ ∥ ∞ \|\cdot\|_\infty ∥ ⋅ ∥ ∞ balls of radius ε / ( 8 M ) \varepsilon/(8M) ε / ( 8 M ) that cover H \mathcal{H} H . Use the Lipschitz step to prove that for each i i i ,
P [ sup h ∈ B ∞ ( h i , ε / ( 8 M ) ) ∣ L S ( h ) ∣ ≥ ε ] ≤ P [ ∣ L S ( h i ) ∣ ≥ ε 2 ] \mathbb{P}\left[\sup_{h\in B_\infty(h_i, \varepsilon/(8M))}|L_S(h)| \geq \varepsilon\right] \leq \mathbb{P}\left[|L_S(h_i)| \geq \frac{\varepsilon}{2}\right]
P [ h ∈ B ∞ ( h i , ε / ( 8 M )) sup ∣ L S ( h ) ∣ ≥ ε ] ≤ P [ ∣ L S ( h i ) ∣ ≥ 2 ε ]
Then apply a concentration inequality (e.g. Hoeffding) to bound P ( ∣ L S ( h i ) ∣ ≥ ε / 2 ) \mathbb{P}(|L_S(h_i)| \geq \varepsilon/2) P ( ∣ L S ( h i ) ∣ ≥ ε /2 ) and conclude ( ⋆ ) (\star) ( ⋆ ) .
Important: Clearly define the random variables you apply Hoeffding to, and justify the bounded range needed for the inequality.
Proof:
Step 1: Use Lipschitz property
Let h ∈ B ∞ ( h i , ε / ( 8 M ) ) h \in B_\infty(h_i, \varepsilon/(8M)) h ∈ B ∞ ( h i , ε / ( 8 M )) , i.e., ∥ h − h i ∥ ∞ ≤ ε / ( 8 M ) \|h - h_i\|_\infty \leq \varepsilon/(8M) ∥ h − h i ∥ ∞ ≤ ε / ( 8 M ) .
By the Lipschitz result from Problem 1:
∣ L S ( h ) − L S ( h i ) ∣ ≤ 4 M ∥ h − h i ∥ ∞ ≤ 4 M ⋅ ε 8 M = ε 2 |L_S(h) - L_S(h_i)| \leq 4M\|h - h_i\|_\infty \leq 4M \cdot \frac{\varepsilon}{8M} = \frac{\varepsilon}{2}
∣ L S ( h ) − L S ( h i ) ∣ ≤ 4 M ∥ h − h i ∥ ∞ ≤ 4 M ⋅ 8 M ε = 2 ε
Step 2: Upper bound transformation
For any h ∈ B ∞ ( h i , ε / ( 8 M ) ) h \in B_\infty(h_i, \varepsilon/(8M)) h ∈ B ∞ ( h i , ε / ( 8 M )) :
∣ L S ( h ) ∣ ≤ ∣ L S ( h i ) ∣ + ∣ L S ( h ) − L S ( h i ) ∣ ≤ ∣ L S ( h i ) ∣ + ε 2 |L_S(h)| \leq |L_S(h_i)| + |L_S(h) - L_S(h_i)| \leq |L_S(h_i)| + \frac{\varepsilon}{2}
∣ L S ( h ) ∣ ≤ ∣ L S ( h i ) ∣ + ∣ L S ( h ) − L S ( h i ) ∣ ≤ ∣ L S ( h i ) ∣ + 2 ε
Therefore:
sup h ∈ B ∞ ( h i , ε / ( 8 M ) ) ∣ L S ( h ) ∣ ≤ ∣ L S ( h i ) ∣ + ε 2 \sup_{h\in B_\infty(h_i, \varepsilon/(8M))}|L_S(h)| \leq |L_S(h_i)| + \frac{\varepsilon}{2}
h ∈ B ∞ ( h i , ε / ( 8 M )) sup ∣ L S ( h ) ∣ ≤ ∣ L S ( h i ) ∣ + 2 ε
Step 3: Probability bound
If sup h ∈ B ∞ ( h i , ε / ( 8 M ) ) ∣ L S ( h ) ∣ ≥ ε \sup_{h\in B_\infty(h_i, \varepsilon/(8M))}|L_S(h)| \geq \varepsilon sup h ∈ B ∞ ( h i , ε / ( 8 M )) ∣ L S ( h ) ∣ ≥ ε , then:
∣ L S ( h i ) ∣ + ε 2 ≥ ε ⟹ ∣ L S ( h i ) ∣ ≥ ε 2 |L_S(h_i)| + \frac{\varepsilon}{2} \geq \varepsilon \implies |L_S(h_i)| \geq \frac{\varepsilon}{2}
∣ L S ( h i ) ∣ + 2 ε ≥ ε ⟹ ∣ L S ( h i ) ∣ ≥ 2 ε
Therefore:
P [ sup h ∈ B ∞ ( h i , ε / ( 8 M ) ) ∣ L S ( h ) ∣ ≥ ε ] ≤ P [ ∣ L S ( h i ) ∣ ≥ ε 2 ] \mathbb{P}\left[\sup_{h\in B_\infty(h_i, \varepsilon/(8M))}|L_S(h)| \geq \varepsilon\right] \leq \mathbb{P}\left[|L_S(h_i)| \geq \frac{\varepsilon}{2}\right]
P [ h ∈ B ∞ ( h i , ε / ( 8 M )) sup ∣ L S ( h ) ∣ ≥ ε ] ≤ P [ ∣ L S ( h i ) ∣ ≥ 2 ε ]
Step 4: Apply Hoeffding’s inequality
Define random variables:
Z j = ( h i ( x j ) − y j ) 2 − E [ ( h i ( x ) − y ) 2 ] , j = 1 , … , m Z_j = (h_i(x_j) - y_j)^2 - \mathbb{E}[(h_i(x) - y)^2], \quad j = 1, \ldots, m
Z j = ( h i ( x j ) − y j ) 2 − E [( h i ( x ) − y ) 2 ] , j = 1 , … , m
Then Z 1 , … , Z m Z_1, \ldots, Z_m Z 1 , … , Z m are i.i.d. random variables with E [ Z j ] = 0 \mathbb{E}[Z_j] = 0 E [ Z j ] = 0 .
Note that:
L S ( h i ) = R ( h i ) − R ^ S ( h i ) = E [ ( h i ( x ) − y ) 2 ] − 1 m ∑ j = 1 m ( h i ( x j ) − y j ) 2 = − 1 m ∑ j = 1 m Z j L_S(h_i) = R(h_i) - \hat{R}_S(h_i) = \mathbb{E}[(h_i(x) - y)^2] - \frac{1}{m}\sum_{j=1}^{m}(h_i(x_j) - y_j)^2 = -\frac{1}{m}\sum_{j=1}^{m}Z_j
L S ( h i ) = R ( h i ) − R ^ S ( h i ) = E [( h i ( x ) − y ) 2 ] − m 1 j = 1 ∑ m ( h i ( x j ) − y j ) 2 = − m 1 j = 1 ∑ m Z j
Determine the bounded range of Z j Z_j Z j :
Since ∣ h i ( x ) − y ∣ ≤ M |h_i(x) - y| \leq M ∣ h i ( x ) − y ∣ ≤ M , we have:
0 ≤ ( h i ( x ) − y ) 2 ≤ M 2 0 \leq (h_i(x) - y)^2 \leq M^2
0 ≤ ( h i ( x ) − y ) 2 ≤ M 2
Therefore ( h i ( x j ) − y j ) 2 ∈ [ 0 , M 2 ] (h_i(x_j) - y_j)^2 \in [0, M^2] ( h i ( x j ) − y j ) 2 ∈ [ 0 , M 2 ] , and E [ ( h i ( x ) − y ) 2 ] ∈ [ 0 , M 2 ] \mathbb{E}[(h_i(x) - y)^2] \in [0, M^2] E [( h i ( x ) − y ) 2 ] ∈ [ 0 , M 2 ] .
So:
Z j ∈ [ − M 2 , M 2 ] Z_j \in [-M^2, M^2]
Z j ∈ [ − M 2 , M 2 ]
The range of Z j Z_j Z j is 2 M 2 2M^2 2 M 2 .
Apply Hoeffding’s inequality:
For bounded independent random variables Z 1 , … , Z m Z_1, \ldots, Z_m Z 1 , … , Z m where Z j ∈ [ a j , b j ] Z_j \in [a_j, b_j] Z j ∈ [ a j , b j ] , Hoeffding’s inequality gives:
P [ ∣ 1 m ∑ j = 1 m Z j ∣ ≥ t ] ≤ 2 exp ( − 2 m 2 t 2 ∑ j = 1 m ( b j − a j ) 2 ) \mathbb{P}\left[\left|\frac{1}{m}\sum_{j=1}^{m}Z_j\right| \geq t\right] \leq 2\exp\left(-\frac{2m^2t^2}{\sum_{j=1}^{m}(b_j - a_j)^2}\right)
P [ m 1 j = 1 ∑ m Z j ≥ t ] ≤ 2 exp ( − ∑ j = 1 m ( b j − a j ) 2 2 m 2 t 2 )
In our case, b j − a j = 2 M 2 b_j - a_j = 2M^2 b j − a j = 2 M 2 , so:
P [ ∣ L S ( h i ) ∣ ≥ ε 2 ] = P [ ∣ 1 m ∑ j = 1 m Z j ∣ ≥ ε 2 ] \mathbb{P}\left[|L_S(h_i)| \geq \frac{\varepsilon}{2}\right] = \mathbb{P}\left[\left|\frac{1}{m}\sum_{j=1}^{m}Z_j\right| \geq \frac{\varepsilon}{2}\right]
P [ ∣ L S ( h i ) ∣ ≥ 2 ε ] = P [ m 1 j = 1 ∑ m Z j ≥ 2 ε ]
≤ 2 exp ( − 2 m 2 ( ε / 2 ) 2 m ( 2 M 2 ) 2 ) = 2 exp ( − 2 m 2 ⋅ ε 2 / 4 m ⋅ 4 M 4 ) = 2 exp ( − m ε 2 8 M 4 ) \leq 2\exp\left(-\frac{2m^2(\varepsilon/2)^2}{m(2M^2)^2}\right) = 2\exp\left(-\frac{2m^2 \cdot \varepsilon^2/4}{m \cdot 4M^4}\right) = 2\exp\left(-\frac{m\varepsilon^2}{8M^4}\right)
≤ 2 exp ( − m ( 2 M 2 ) 2 2 m 2 ( ε /2 ) 2 ) = 2 exp ( − m ⋅ 4 M 4 2 m 2 ⋅ ε 2 /4 ) = 2 exp ( − 8 M 4 m ε 2 )
We obtain:
P [ ∣ L S ( h i ) ∣ ≥ ε 2 ] ≤ 2 exp ( − m ε 2 2 M 4 ) \mathbb{P}\left[|L_S(h_i)| \geq \frac{\varepsilon}{2}\right] \leq 2\exp\left(-\frac{m\varepsilon^2}{2M^4}\right)
P [ ∣ L S ( h i ) ∣ ≥ 2 ε ] ≤ 2 exp ( − 2 M 4 m ε 2 )
Step 5: Combine to obtain the final bound
By the union bound from Problem 2, with B i = B ∞ ( h i , ε / ( 8 M ) ) B_i = B_\infty(h_i, \varepsilon/(8M)) B i = B ∞ ( h i , ε / ( 8 M )) covering H \mathcal{H} H :
P [ sup h ∈ H ∣ L S ( h ) ∣ ≥ ε ] ≤ ∑ i = 1 k P [ sup h ∈ B i ∣ L S ( h ) ∣ ≥ ε ] \mathbb{P}\left[\sup_{h\in\mathcal{H}}|L_S(h)| \geq \varepsilon\right] \leq \sum_{i=1}^{k}\mathbb{P}\left[\sup_{h\in B_i}|L_S(h)| \geq \varepsilon\right]
P [ h ∈ H sup ∣ L S ( h ) ∣ ≥ ε ] ≤ i = 1 ∑ k P [ h ∈ B i sup ∣ L S ( h ) ∣ ≥ ε ]
≤ ∑ i = 1 k P [ ∣ L S ( h i ) ∣ ≥ ε 2 ] ≤ k ⋅ 2 exp ( − m ε 2 2 M 4 ) \leq \sum_{i=1}^{k}\mathbb{P}\left[|L_S(h_i)| \geq \frac{\varepsilon}{2}\right] \leq k \cdot 2\exp\left(-\frac{m\varepsilon^2}{2M^4}\right)
≤ i = 1 ∑ k P [ ∣ L S ( h i ) ∣ ≥ 2 ε ] ≤ k ⋅ 2 exp ( − 2 M 4 m ε 2 )
= N ( H , ε 8 M ) ⋅ 2 exp ( − m ε 2 2 M 4 ) = \mathcal{N}\left(\mathcal{H}, \frac{\varepsilon}{8M}\right) \cdot 2\exp\left(-\frac{m\varepsilon^2}{2M^4}\right)
= N ( H , 8 M ε ) ⋅ 2 exp ( − 2 M 4 m ε 2 )
Part II: Simulation verification (40%, open design)
In this part, you will design your own simulation to empirically estimate the LHS probability in ( ⋆ ) (\star) ( ⋆ ) and compare it with the RHS bound.
Experimental Setup
Hypothesis Class: Clipped Linear Functions
Domain and Range:
X = [ 0 , 1 ] \mathcal{X} = [0, 1] X = [ 0 , 1 ]
Y = [ − 1 , 1 ] \mathcal{Y} = [-1, 1] Y = [ − 1 , 1 ]
Hypothesis Class: Clipped linear functions
H = { h w : w ∈ [ − 1 , 1 ] } , h w ( x ) = clip ( w x , − 1 , 1 ) \mathcal{H} = \{h_w : w \in [-1, 1]\}, \quad h_w(x) = \text{clip}(wx, -1, 1)
H = { h w : w ∈ [ − 1 , 1 ]} , h w ( x ) = clip ( w x , − 1 , 1 )
where clip ( z , − 1 , 1 ) = max ( − 1 , min ( 1 , z ) ) \text{clip}(z, -1, 1) = \max(-1, \min(1, z)) clip ( z , − 1 , 1 ) = max ( − 1 , min ( 1 , z )) .
Data Distribution D D D :
x ∼ Uniform ( 0 , 1 ) x \sim \text{Uniform}(0, 1) x ∼ Uniform ( 0 , 1 )
y = clip ( 0.5 x + η , − 1 , 1 ) y = \text{clip}(0.5x + \eta, -1, 1) y = clip ( 0.5 x + η , − 1 , 1 ) , where η ∼ N ( 0 , 0.1 2 ) \eta \sim \mathcal{N}(0, 0.1^2) η ∼ N ( 0 , 0. 1 2 )
Boundedness Constant M M M
For x ∈ [ 0 , 1 ] x \in [0, 1] x ∈ [ 0 , 1 ] and w ∈ [ − 1 , 1 ] w \in [-1, 1] w ∈ [ − 1 , 1 ] :
h w ( x ) ∈ [ − 1 , 1 ] h_w(x) \in [-1, 1] h w ( x ) ∈ [ − 1 , 1 ]
y ∈ [ − 1 , 1 ] y \in [-1, 1] y ∈ [ − 1 , 1 ]
Therefore:
∣ h w ( x ) − y ∣ ≤ ∣ h w ( x ) ∣ + ∣ y ∣ ≤ 1 + 1 = 2 |h_w(x) - y| \leq |h_w(x)| + |y| \leq 1 + 1 = 2
∣ h w ( x ) − y ∣ ≤ ∣ h w ( x ) ∣ + ∣ y ∣ ≤ 1 + 1 = 2
We set M = 2 M = 2 M = 2 .
Covering Number Calculation
For w 1 , w 2 ∈ [ − 1 , 1 ] w_1, w_2 \in [-1, 1] w 1 , w 2 ∈ [ − 1 , 1 ] , consider ∥ h w 1 − h w 2 ∥ ∞ \|h_{w_1} - h_{w_2}\|_\infty ∥ h w 1 − h w 2 ∥ ∞ .
In the non-clipping region, for x ∈ [ 0 , 1 ] x \in [0, 1] x ∈ [ 0 , 1 ] :
∣ h w 1 ( x ) − h w 2 ( x ) ∣ = ∣ w 1 x − w 2 x ∣ = ∣ w 1 − w 2 ∣ ⋅ x ≤ ∣ w 1 − w 2 ∣ |h_{w_1}(x) - h_{w_2}(x)| = |w_1 x - w_2 x| = |w_1 - w_2| \cdot x \leq |w_1 - w_2|
∣ h w 1 ( x ) − h w 2 ( x ) ∣ = ∣ w 1 x − w 2 x ∣ = ∣ w 1 − w 2 ∣ ⋅ x ≤ ∣ w 1 − w 2 ∣
The maximum is achieved at x = 1 x = 1 x = 1 (when no clipping occurs):
∥ h w 1 − h w 2 ∥ ∞ ≤ ∣ w 1 − w 2 ∣ \|h_{w_1} - h_{w_2}\|_\infty \leq |w_1 - w_2|
∥ h w 1 − h w 2 ∥ ∞ ≤ ∣ w 1 − w 2 ∣
To ensure ∥ h w 1 − h w 2 ∥ ∞ ≤ r \|h_{w_1} - h_{w_2}\|_\infty \leq r ∥ h w 1 − h w 2 ∥ ∞ ≤ r , we need ∣ w 1 − w 2 ∣ ≤ r |w_1 - w_2| \leq r ∣ w 1 − w 2 ∣ ≤ r .
Therefore, covering [ − 1 , 1 ] [-1, 1] [ − 1 , 1 ] with a grid of spacing r r r requires:
N ( H , r ) ≤ ⌈ 2 r ⌉ + 1 \mathcal{N}(\mathcal{H}, r) \leq \left\lceil \frac{2}{r} \right\rceil + 1
N ( H , r ) ≤ ⌈ r 2 ⌉ + 1
For r = ε / ( 8 M ) = ε / 16 r = \varepsilon/(8M) = \varepsilon/16 r = ε / ( 8 M ) = ε /16 :
N ( H , ε 16 ) ≤ ⌈ 32 ε ⌉ + 1 \mathcal{N}\left(\mathcal{H}, \frac{\varepsilon}{16}\right) \leq \left\lceil \frac{32}{\varepsilon} \right\rceil + 1
N ( H , 16 ε ) ≤ ⌈ ε 32 ⌉ + 1
Experimental Parameters
Parameter
Value
Sample size grid m m m
[50, 100, 200, 500, 1000, 2000, 5000]
Error grid ε \varepsilon ε
[0.1, 0.2, 0.3, 0.5]
Monte Carlo trials T T T
1000
Test set size (for true risk estimation)
50000
Hypothesis class discretization
201 uniformly spaced w w w values in [ − 1 , 1 ] [-1, 1] [ − 1 , 1 ]
Random seed
42
Python version
3.9+
True Risk Estimation
We approximate R ( h ) R(h) R ( h ) using a large independent test set (50,000 samples):
R ( h ) ≈ 1 n t e s t ∑ i = 1 n t e s t ( h ( x i t e s t ) − y i t e s t ) 2 R(h) \approx \frac{1}{n_{test}}\sum_{i=1}^{n_{test}}(h(x_i^{test}) - y_i^{test})^2
R ( h ) ≈ n t es t 1 i = 1 ∑ n t es t ( h ( x i t es t ) − y i t es t ) 2
A test set of 50,000 samples is sufficiently large to control the estimation error.
Experimental Results
After running the code, we obtain the following results (see simulation.py for details):
Results Table
Comparison of empirical probability p ^ ( m , ε ) \hat{p}(m, \varepsilon) p ^ ( m , ε ) and theoretical bound RHS for different ( m , ε ) (m, \varepsilon) ( m , ε ) combinations:
m m m
ε \varepsilon ε
p ^ ( m , ε ) \hat{p}(m,\varepsilon) p ^ ( m , ε )
RHS (Theoretical Bound)
RHS > 1?
50
0.10
0.3070
6.32e+02
Yes
100
0.10
0.1590
6.22e+02
Yes
200
0.10
0.0320
6.03e+02
Yes
500
0.10
0.0000
5.49e+02
Yes
1000
0.10
0.0000
4.70e+02
Yes
50
0.20
0.0490
3.02e+02
Yes
100
0.20
0.0050
2.84e+02
Yes
5000
0.20
0.0000
0.6216
No
50
0.30
0.0030
1.88e+02
Yes
2000
0.30
0.0000
0.7790
No
5000
0.30
0.0000
0.0002
No
1000
0.50
0.0000
0.0526
No
Covering Numbers:
ε = 0.1 \varepsilon = 0.1 ε = 0.1 : N ( H , 0.0063 ) = 321 \mathcal{N}(\mathcal{H}, 0.0063) = 321 N ( H , 0.0063 ) = 321
ε = 0.2 \varepsilon = 0.2 ε = 0.2 : N ( H , 0.0125 ) = 161 \mathcal{N}(\mathcal{H}, 0.0125) = 161 N ( H , 0.0125 ) = 161
ε = 0.3 \varepsilon = 0.3 ε = 0.3 : N ( H , 0.0187 ) = 108 \mathcal{N}(\mathcal{H}, 0.0187) = 108 N ( H , 0.0187 ) = 108
ε = 0.5 \varepsilon = 0.5 ε = 0.5 : N ( H , 0.0312 ) = 65 \mathcal{N}(\mathcal{H}, 0.0312) = 65 N ( H , 0.0312 ) = 65