All problems
Ensemble Error Ratio Weight
Problem
Compute the weight on the statistical forecast from the two mean errors: err_neural / (err_stat + err_neural).
Return 0.5 when both errors are non-positive. The larger a model's error, the smaller its weight.
Hint
This is a simple, robust alternative to inverse-variance weighting.
Test cases
case 1
in: [1,3]
expected: 0.75
case 2
in: [2,2]
expected: 0.5
case 3
in: [0,4]
expected: 1
case 4
in: [5,0]
expected: 0
Starter codePython
def ensemble_error_ratio_weight(err_stat, err_neural):
# Your code here
pass4 test cases · run your code against them in the editor