Open teytaud opened 3 years ago
@Dvermetten and @jacobdenobel should be able to either do this or to help with any questions
Hi :)
I'm just wondering, can I instead add CMA-ES support in Nevergrad by using cmaes
library (repo: https://github.com/CyberAgent/cmaes)?
cmaes
library provides ask-and-tell API so that it is easy to integrate with Nevergrad. The implementation is reliable as adopted by Optuna framework and continuously benchmarked on GitHub Actions.
https://medium.com/optuna/introduction-to-cma-es-sampler-ee68194c8f88
Furthermore, one of the most important characteristics of this library is Warm Starting CMA-ES support, one of the state-of-the-art methods on transfer hyperparameter optimization. Warm Starting CMA-ES utilizes the result on a source task and enables CMA-ES to be initialized on the promising region. Consequently, It significantly reduces the required number of evaluations.
I'm glad if you will have an interest in cmaes
library.
Thank you.
in progress, #1133
Modular CMA is packaged and should be easy to integrate in Nevergrad. Example of usage of "modcma" below:
import random import numpy as np from modcma import AskTellCMAES
DIMENSION = 10 POPULATION_SIZE = 20 STEP_SIZE = 1.0 TARGET = 79.34
def objective_function(x): """'Simple sphere function""" return np.linalg.norm(x) + TARGET
def example1(): """Example of running ask and tell consecutively.""" cma = AskTellCMAES( DIMENSION, lambda_=POPULATION_SIZE, init_sigma=STEP_SIZE, )
def example2(): """Example of running ask first and telling in random order.""" cma = AskTellCMAES(DIMENSION, lambda_=POPULATION_SIZE, init_sigma=STEP_SIZE)
def example3(): """Example of running ask-tell until convergence.""" cma = AskTellCMAES( DIMENSION, target=TARGET + 1e-8, lambda_=POPULATION_SIZE, init_sigma=STEP_SIZE ) while not any(cma.break_conditions): xi = cma.ask() cma.tell(xi, objective_function(xi))
if name == "main": np.random.seed(42) example1() example2() example3()