All problems
Generalization Bound
Problem
Return the Rademacher generalization bound:
true risk <= empirical risk + rademacher + sqrt(ln(1 / delta) / (2 * m))
Return just the two-term complexity penalty added to the empirical risk.
Hint
More samples shrink the confidence term as 1 / sqrt(m).
Test cases
case 1
in: [0.1,100,0.05]
expected: 0.22238734153404083
case 2
in: [0,50,0.1]
expected: 0.15174271293851463
case 3
in: [0.2,10,0.01]
expected: 0.6798525912188081
case 4
in: [0.05,1000,0.2]
expected: 0.07836756873997225
Starter codePython
import math
def generalization_bound(rademacher, m, delta):
# Your code here
pass4 test cases · run your code against them in the editor