All problems
Predictive Residual Entropy
Problem
Return the differential entropy in bits of the residual after first-order linear prediction:
h = 0.5 * log2(2 * pi * e * var * (1 - rho^2))
where var is the signal variance and rho the correlation with the predictor. Assume |rho| < 1.
Hint
Better prediction shrinks the residual variance by (1 - rho^2).
Test cases
case 1
in: [1,0]
expected: 2.047095585180641
case 2
in: [1,0.5]
expected: 1.8395768355412192
case 3
in: [4,0]
expected: 3.047095585180641
case 4
in: [1,0.9]
expected: 0.8491312470150711
Starter codePython
import math
def residual_entropy(var, rho):
# Your code here
pass4 test cases · run your code against them in the editor