All problems
ARS Perturbation Seeded
Problem
Draw a Gaussian perturbation direction with rng = random.Random(seed) and rng.gauss(0, 1) per dimension. The seed makes the direction reproducible.
Hint
Augmented random search samples one direction and evaluates both signs of it.
Test cases
case 1
in: [3,42]
expected: [-0.14409032957792836,-0.1729036003315193,-0.11131586156766246]
case 2
in: [2,0]
expected: [0.9417154046806644,-1.3965781047011498]
case 3
in: [1,7]
expected: [-0.2558802884476004]
Starter codePython
import random
def ars_perturbation(dim, seed):
# Your code here
pass3 test cases · run your code against them in the editor