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.5.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

optuna_async_helper-0.5.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: optuna_async_helper-0.5.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.29

File hashes

Hashes for optuna_async_helper-0.5.0.tar.gz
Algorithm Hash digest
SHA256 f3ee754d727b474f532ae2b3da8a66e313b2393c8f33550931a737a2a0c97e6e
MD5 992b143a45b4909bdbbdf5008b4979e0
BLAKE2b-256 351674eb23643ba65b8b4d066cb634d8d5e43e7e9a8dc27c39ce345715b259e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for optuna_async_helper-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d6f97acacb4f4c72fbe6403fa6b0a8ee8031606d978c5a238219491ace08970
MD5 fe42a18ceddf988e4239ff27bfc38729
BLAKE2b-256 7d1dacea8e236ec8b20f94fa19ea00c48358bd21fa364d57ddf88e99e2cc5c9b

See more details on using hashes here.

Supported by

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