-
Notifications
You must be signed in to change notification settings - Fork 45
Add CMAES optimizer from nevergrad and refactor existing code #591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add CMAES optimizer from nevergrad and refactor existing code #591
Conversation
Hi @gauravmanmode, thanks for the PR. I definitely like the idea of your Regarding the Executor: There was an argument brought forward by @r3kste that suggests it would be better to use the low-level ask-and-tell interface if we want to support parallelism. While I still think the solution with the custom Executor can be made to work, I think that the ask-and-tell interface is simpler and more readable for this. |
Currently your tests fail because nevergrad is not compatible with numpy 2.0 and higher. You can pin numpy in the environment file for now. |
Or better: Install nevergrad via pip instead of conda. The conda version is outdated. Then you don't need to pin any numpy versions. |
Codecov ReportAttention: Patch coverage is
🚀 New features to boost your workflow:
|
Hi, @janosg , Here is the list of parameter names I have referred to nevergrad_cmaes
what kind of tests should i have for the internal helper function ? |
Hi @janosg, |
Hi @gauravmanmode, yes please go ahead and refactor the code for pso as well. I would stick to approach one, i.e. passing the configured optimizer object to the internal function. It is more in line with the design philosophy shown here. |
About the names:
I would mainly add a name for stopping_maxfun. Other convergence criteria are super hard to test. If you cannot get a loss out of nevergrad for some optimizers you can evaluate problem.fun at the solution for now and create an issue with a minimal example at nevergrad to get feedback. I wouldn't frame it as a bug report (unless you are absolutely sure) but rather frame it as a question whether you are using the library correctly. |
for more information, see https://pre-commit.ci
UpdateRefactored the code and improved type annotations. "nevergrad_cmaes"
|
Hi @gauravmanmode, thanks for the update. For all names that start with CSA_ or CMA I would stick to the original. Your names are a bit more descriptive but I would still need a longer description to understand what they do and what values they can take. So we can stick to the originals to make it easier to switch from nevergrad and put the rest into the documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gauravmanmode, this looks very good already. I just made a few minor comments.
Updated PR Description
This PR aims to
Hi @janosg
I am wrapping the CMA-ES optimizer from nevergrad
Will be adding tests and docs shortly.
Referring from the discussion in the existing PR's and issues,
some things I have experimented with are:
Using a CustomExecutor, for time consuming objective functions, benchmarking reveals
whereas with lightweight objective functions, n_cores = 1 seemed more preferrable
Is this in the right direction?