Skip to main content

A Helper Library for Optuna Async Optimization

Project description

Optuna Async Helper

A Helper Library for Optuna Async Optimization

Install

pip install optuna-async-helper

Usage

from optuna_async_helper import SearchSpace, SearchSpec, optimize


def rosenbrock(x: float, y: float) -> float:
    return (1 - x) ** 2 + 100 * (y - x**2) ** 2


search_space: SearchSpace = [
    SearchSpec(var_name="x", var_type="float", low=-5, high=5),
    SearchSpec(var_name="y", var_type="float", low=-5, high=5),
]

with tempfile.TemporaryDirectory() as tempdir:
    study = optimize(
        study_name="rosenbrock",
        storage=f"sqlite:///example.db",
        objective_func=rosenbrock,
        search_space=search_space,
        n_trials=50,
        batch_size=4,
    )

    assert study.best_value < 1.0
    assert abs(study.best_params["x"] - 1) < 1.0
    assert abs(study.best_params["y"] - 1) < 1.0

For more detail, please check optimize and SearchSpec definitions.

Development

The project is managed by uv

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

optuna_async_helper-0.4.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

optuna_async_helper-0.4.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file optuna_async_helper-0.4.0.tar.gz.

File metadata

  • Download URL: optuna_async_helper-0.4.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for optuna_async_helper-0.4.0.tar.gz
Algorithm Hash digest
SHA256 8851e018ced3ef11bda7c1482bb08d3cb4d320f6551f037a14a685ccc3f9e987
MD5 2dacd3e3e9bfcd32bba49d62c9cf31df
BLAKE2b-256 0cea3d9847065ede1cf9176a48200a2f33ed4209e047fea041b13bf68f94dc66

See more details on using hashes here.

File details

Details for the file optuna_async_helper-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for optuna_async_helper-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7ab6896584fe5e9e067cb63f956a891fbe7e5763ce1d04c6ed0b38633175439
MD5 bd0aae1765db76622ba88e8081211b61
BLAKE2b-256 27b2a2c3d94e590edb9005a73941f10e4778a9a90f1e015a09e7669d2c472b3a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page