RobertTLange / evosax

Evolution Strategies in JAX 🦎
Apache License 2.0
475 stars 44 forks source link

Avoid ZeroDivisionError in PGPE #33

Closed smonsays closed 1 year ago

smonsays commented 1 year ago

I am seeing many ZeroDivisionError: float division by zero errors when using PGPE. The offending line is the following

theta_grad = 1.0 / self.elite_popsize * fit_diff_noise

Unless there is more principled way to do it, I would suggest to make the division numerically save as in this proposed commit.

RobertTLange commented 1 year ago

That is odd. What elite_popsize are you using? Also check out the updated PGPE in the fixes branch. There was something wrong with indexing the antithetic samples: https://github.com/RobertTLange/evosax/blob/fixes/evosax/strategies/pgpe.py

smonsays commented 1 year ago

Ah indeed it was the elite_popsize and is already fixed after #30. Closing this then, sorry for the bother!