All problems
Expert Advice Weighted Average
Problem
Combine expert predictions with a weighted average.
Return sum(w_i * p_i) / sum(w_i), or 0.0 when the weights sum to zero.
Hint
This is the exponentially weighted forecaster's prediction.
Test cases
case 1
in: [[1,3],[1,1]]
expected: 2
case 2
in: [[2,4,6],[0.5,0.25,0.25]]
expected: 3.5
case 3
in: [[5,1],[3,1]]
expected: 4
case 4
in: [[1,2],[0,0]]
expected: 0
Starter codePython
def expert_weighted_average(predictions, weights):
# Your code here
pass4 test cases · run your code against them in the editor