All problems
Gaussian Rate-Distortion Distortion
Problem
Return the Gaussian rate-distortion distortion at rate R for a source with variance var:
D(R) = var * 2^(-2R)
Hint
Each additional bit per sample quarters the distortion.
Test cases
case 1
in: [1,1]
expected: 0.25
case 2
in: [0.5,4]
expected: 2
case 3
in: [2,1]
expected: 0.0625
case 4
in: [1,2]
expected: 0.5
Starter codePython
def gaussian_distortion(rate, var):
# Your code here
pass4 test cases · run your code against them in the editor