All problems
CEM Mean Update
Problem
Update the cross-entropy method distribution by averaging the elite samples.
Take the top max(1, int(n * elite_frac)) samples by score (ties broken by smallest index) and return their mean vector. No samples returns [].
Hint
Only the elite fraction of samples shapes the next search distribution.
Test cases
case 1
in: [[[0,0],[1,2],[2,4],[3,6]],[1,4,3,2],0.5]
expected: [1.5,3]
case 2
in: [[[1],[2],[3]],[5,5,1],1]
expected: [2]
case 3
in: [[[0],[1]],[1,2],0.6]
expected: [1]
Starter codePython
def cem_mean_update(samples, scores, elite_frac):
# Your code here
pass3 test cases · run your code against them in the editor