skillfed

cmaes

Lightweight Covariance Matrix Adaptation Evolution Strategy (CMA-ES) implementation for Python 3.

cmaes v0.13.0 1.3M downloads/30d#4,034 on PyPI515
Permissive license MIT Active released

What it is and what it does

cmaes is a Python implementation of the Covariance Matrix Adaptation Evolution Strategy, a derivative-free optimization algorithm designed to minimize or maximize black-box objective functions. It uses an ask-and-tell interface where you request candidate solutions from the optimizer, evaluate them with your objective function, and report results back—making it suitable for expensive or noisy function evaluations where gradients are unavailable or unreliable.

The library supports multiple problem types: standard continuous optimization via the CMA class, mixed continuous-integer-categorical optimization via CatCMAwM, and multi-objective mixed-variable problems via COMOCatCMAwM. It depends only on numpy and integrates with Optuna for hyperparameter tuning workflows. The implementation is actively maintained and supports Python 3.9 through 3.14.

Use it for:

  • Hyperparameter tuning for machine learning models when gradient-based methods are impractical or unavailable.
  • Optimizing expensive simulations or physical experiments where function evaluations are costly and noisy.
  • Mixed-variable optimization combining continuous parameters, discrete choices, and categorical selections in a single problem.
  • Multi-objective optimization balancing competing objectives in mixed-variable spaces.
  • Black-box function optimization where the objective function is a complex pipeline or external tool.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides CMA-ES (Covariance Matrix Adaptation Evolution Strategy) optimization in an ask-and-tell interface, supporting continuous, integer, and categorical variable optimization with variants for mixed-variable and multi-objective problems.

Yes. Low install friction (numpy only), active maintenance, MIT license, no known vulnerabilities, and a focused implementation of a well-established algorithm make it a solid choice for derivative-free optimization. Install if you need CMA-ES specifically; if you're unsure whether CMA-ES is the right algorithm for your problem, verify that first.

Install

cmaes on PyPI

pip

pip install cmaes

uv

uv add cmaes

poetry

poetry add cmaes

Installing cmaes

Before you install

Low friction: pure Python wheel with only numpy as a runtime dependency. Active maintenance with recent releases; last commit 2026-08-07 and 515 repository stars indicate ongoing development.

License in practice

MIT license permits commercial and private use with minimal restrictions, making it suitable for most projects without legal friction.

Quickstart

pip install cmaes

import numpy as np
from cmaes import CMA

optimizer = CMA(mean=np.zeros(2), sigma=1.3)
for generation in range(50):
    solutions = []
    for _ in range(optimizer.population_size):
        x = optimizer.ask()
        value = objective(x)  # your function
        solutions.append((x, value))
    optimizer.tell(solutions)

Requires Python 3.9 or later.

Verify before relying

  • Performance characteristics and convergence speed compared to other CMA-ES implementations or optimization libraries.
  • Whether the library is suitable for high-dimensional problems (scalability limits not documented in excerpt).
  • Integration requirements and compatibility with Optuna beyond the basic sampler example shown.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 139 days since the last release
Last repo commit
First released
Downloads 1,335,688/month — #4,034 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: cmaes-0.13.0-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9

Tags

CMA-ES optimization libraryevolutionary strategy optimizermixed-variable optimizationblack-box function optimizationhyperparameter optimizationcontinuous and categorical optimizationderivative-free optimization
optimizationevolutionary-algorithmshyperparameter-tuning

More Artificial Intelligence packages

Further reading