All problems
CMA-ES Mean Update Lite
Problem
Compute the CMA-ES weighted mean update from a ranked population.
Sort indices by fitness descending, with the lower index winning ties. For ranks 0 .. mu-1 use weight log(mu + 0.5) - log(rank + 1), and normalize the selected weights to sum to 1. Return the weighted average of the selected individuals.
Hint
Log-decreasing weights favor the best individuals but never assign zero to the runners-up.
Test cases
case 1
in: [[[0],[2],[4],[10]],[1,4,2,0.5],2]
expected: [2.3916742801345414]
case 2
in: [[[1,1],[2,0],[0,3]],[3,1,2],2]
expected: [0.8041628599327295,1.3916742801345412]
case 3
in: [[[5],[1]],[0.1,0.9],1]
expected: [1]
Starter codePython
def cma_mean_update(population, fitness, mu):
# Your code here
pass3 test cases · run your code against them in the editor