All problems
Residual Modeling
Problem
Add a residual forecast to a base forecast elementwise: base + residual.
Return the combined forecast; zip truncates to the shorter list. This is the hybrid pattern of a structural model plus a learned residual correction.
Hint
The base model captures structure; the residual model captures what is left.
Test cases
case 1
in: [[1,2],[0.5,0.5]]
expected: [1.5,2.5]
case 2
in: [[5,5,5],[0,0,0]]
expected: [5,5,5]
case 3
in: [[1],[1]]
expected: [2]
case 4
in: [[],[]]
expected: []
Starter codePython
def residual_modeling(base_forecast, residual_forecast):
# Your code here
pass4 test cases · run your code against them in the editor