All problems
Model Soup Mean And Spread
Problem
Average a list of model parameter vectors and measure their spread.
All models are flat lists of the same length. Return [mean, max_deviation] where mean is the coordinatewise average and max_deviation is the largest absolute difference between any model coordinate and its mean. An empty list returns [[], 0.0].
Hint
The spread tells you how far the soup ingredients are from the final average.
Test cases
case 1
in: [[[1,2],[3,4],[5,6]]]
expected: [[3,4],2]
case 2
in: [[[0,0],[2,4]]]
expected: [[1,2],2]
case 3
in: [[[1],[1]]]
expected: [[1],0]
case 4
in: [[]]
expected: [[],0]
Starter codePython
def model_soup_mean_and_spread(models):
# Returns [mean, max_deviation]
# Your code here
pass4 test cases · run your code against them in the editor