Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-336

Multiplicative Decomposition Ratios

Problem

Compute the remainder ratios of a multiplicative decomposition by dividing the observed series by the product of the trend and seasonal components: series[t] / (trend[t] * seasonal[t]).

Use 0.0 for a position where the product of trend and seasonal is zero. Return an empty list when the inputs do not all have the same length.

Hint

Multiplicative decompositions divide, just as additive decompositions subtract.

Test cases

case 1
in: [[10,20],[2,4],[1,1]]
expected: [5,5]
case 2
in: [[12,15],[3,0],[1,1]]
expected: [4,0]
case 3
in: [[1],[1],[0]]
expected: [0]
case 4
in: [[1,2],[1],[]]
expected: []
Starter codePython
def multiplicative_ratios(series, trend, seasonal):
    # Your code here
    pass

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