Skip to content
DeepForgeby svx
All problems
MediumTime Seriests-311

Trigg Tracking Signal

Problem

Compute Trigg's tracking signal from a list of forecast errors. Maintain a smoothed error and a smoothed absolute error with the same alpha: E = alpha * e + (1 - alpha) * E and M = alpha * |e| + (1 - alpha) * M, then return E / M.

Return 0.0 for empty input or when the smoothed absolute error is zero.

Hint

Smoothing both the error and its magnitude makes the signal less jumpy than a plain ratio.

Test cases

case 1
in: [[1,1,1],0.5]
expected: 1
case 2
in: [[1,-1,1,-1],0.5]
expected: -0.3333333333333333
case 3
in: [[0,0,0],0.5]
expected: 0
case 4
in: [[],0.3]
expected: 0
case 5
in: [[2,4,6],0.25]
expected: 1
Starter codePython
def trigg_tracking_signal(errors, alpha):
    # Your code here
    pass

5 test cases · run your code against them in the editor