All problems
Polyak Averaging Uniform Weights
Problem
Polyak-Ruppert averaging gives each of the k iterates weight 1/k.
Given k > 0, return the list of k uniform weights.
Hint
All weights are equal and sum to one.
Test cases
case 1
in: [1]
expected: [1]
case 2
in: [3]
expected: [0.3333333333333333,0.3333333333333333,0.3333333333333333]
case 3
in: [5]
expected: [0.2,0.2,0.2,0.2,0.2]
Starter codePython
def polyak_averaging_uniform_weights(k):
# Your code here
pass3 test cases · run your code against them in the editor