CyberAgentAILab / cmaes

Python library for CMA Evolution Strategy.
https://arxiv.org/abs/2402.01373
MIT License
359 stars 62 forks source link

question about _xnes #155

Closed d-nagata closed 10 months ago

d-nagata commented 10 months ago

Bug reports

Please file a bug report here.

Expected Behavior

Please describe the behavior you are expecting

Current Behavior and Steps to Reproduce

What is the current behavior? Please provide detailed steps or example for reproducing.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Sorry, it is not bug, but question about your imprementation. I couldn't find the appropriate place, so I would like to ask a question here. In the usage examples of xnes, an example of a minimization was shown. However, the original paper of xnes("Exponential Natural Evolution Strategies") deals with a maximization problem. I checked the code, but I couldn't find any specific changes from the original paper, and I couldn't understand where they switch between the maximization and minimization problems. I would be grateful if you could enlighten me how do you change maximize or minimize.

d-nagata commented 10 months ago

@nomuramasahir0 I apologize, but would it be possible to answer this question?

nomuramasahir0 commented 10 months ago

Hi @ikalemmon ,

Thank you for the question. The change of maximization and minimization is absorbed by the utility function (u in the original paper). By fitness shaping,

d-nagata commented 10 months ago

@nomuramasahir0 Thank you for your answer. But I'm still confused...

I think the implementation of u is here https://github.com/CyberAgentAILab/cmaes/blob/91bcaca06eef8193d8ee6a65b2a2bec0b5cfb114/cmaes/_xnes.py#L91-L101 I can't find the change from the paper in that code...

image
nomuramasahir0 commented 10 months ago

Fitness shaping replaces the function value (more concretely, f(x_i) / n in the original xNES paper, or -f(x_i) / n in our implementation) with u_i. The original xNES paper and our implementation set u_i to the one you provided.

nomuramasahir0 commented 10 months ago

As for the fitness shaping, for example, please see the NES tutorial slide, pp.23.

d-nagata commented 10 months ago

@nomuramasahir0 thanks, I checked it! Could you show me the relevant part of the code in _xnes.py?

d-nagata commented 10 months ago

Sorry, I understand!!(sort of solutions is ascending, but the paper was descending.) Thank you for your detailed expranation!!

nomuramasahir0 commented 10 months ago

Sure!