All problems
SES Cumulative Weight
Problem
Compute the total weight that simple exponential smoothing puts on the first k observations, counting from the most recent observation backward. The geometric sum equals 1 - (1 - alpha)^k.
Return 0.0 when k is not positive.
Hint
The weights sum to one as k grows without bound.
Test cases
case 1
in: [0.5,2]
expected: 0.75
case 2
in: [0.5,0]
expected: 0
case 3
in: [0.3,3]
expected: 0.657
case 4
in: [1,3]
expected: 1
Starter codePython
def ses_cumulative_weight(alpha, k):
# Your code here
pass4 test cases · run your code against them in the editor