All problems
SGLD Noise Scale
Problem
Compute the SGLD noise standard deviation for a given step size.
Return sqrt(2 * lr * temperature), or 0.0 when lr or temperature is not positive. This is the amount of Gaussian noise added per coordinate.
Hint
The noise scale grows with the square root of the step size and temperature.
Test cases
case 1
in: [0.1,1]
expected: 0.4472135954999579
case 2
in: [0.01,2]
expected: 0.2
case 3
in: [0,1]
expected: 0
case 4
in: [0.5,0.5]
expected: 0.7071067811865476
Starter codePython
def sgld_noise_scale(lr, temperature):
# Your code here
pass4 test cases · run your code against them in the editor