Skip to content
DeepForgeby svx
All problems
HardTime Seriests-217

Cross-Temporal Reconciliation Lite

Problem

Reconcile a set of sub-period forecasts with a known aggregate by scaling: adjusted[x] = x * aggregate / sum(series).

Return zero-scaled values when the series sums to zero, so the reconciled values still sum to the aggregate when possible.

Hint

Scaling preserves the relative shape of the sub-period forecasts.

Test cases

case 1
in: [[1,2,3],12]
expected: [2,4,6]
case 2
in: [[1,1],4]
expected: [2,2]
case 3
in: [[0,0],5]
expected: [0,0]
case 4
in: [[2,3,5],10]
expected: [2,3,5]
Starter codePython
def cross_temporal_reconciliation_lite(series, aggregate):
    # Your code here
    pass

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