Skip to content
DeepForgeby svx
All problems
EasyTime Seriests-059

Forecast Combination Weight Inverse Error

Problem

Compute the inverse-error weight for the first of two forecasts: w1 = (1/mse1) / (1/mse1 + 1/mse2).

If both MSEs are non-positive return 0.5; if only mse1 is non-positive return 1.0; if only mse2 is non-positive return 0.0.

Hint

The more accurate forecast (smaller MSE) receives the larger weight.

Test cases

case 1
in: [1,1]
expected: 0.5
case 2
in: [1,3]
expected: 0.75
case 3
in: [4,4]
expected: 0.5
case 4
in: [0,2]
expected: 1
Starter codePython
def combination_weight_inverse_error(mse1, mse2):
    # Your code here
    pass

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