Skip to main content

Optuna Async Helper

A Helper Library for Optuna Async Optimization

Install

pip install optuna-async-helper

Usage

import tempfile

from optuna_async_helper import (
    SearchSpace,
    SearchSpec,
    optimize,
    create_journal_storage,
    create_study,
)


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


def test_optimizer():
    search_space: SearchSpace = [
        SearchSpec(var_name="x", domain_type="float", low=-5, high=5),
        SearchSpec(var_name="y", domain_type="float", low=-5, high=5),
    ]
    z = 0.5
    initial_params = [
        {"x": 0, "y": 0},
        {"x": 1.0, "y": 0},
        {"x": 0, "y": 1.0},
    ]

    with tempfile.TemporaryDirectory() as tempdir:
        storage = create_journal_storage(f"{tempdir}/example.db")
        study = create_study(
            study_name="rosenbrock",
            storage=storage,
        )
        study = optimize(
            study,
            objective_func=rosenbrock,
            search_space=search_space,
            initial_params=initial_params,
            n_trials=10,
            batch_size=32,
            z=z,
        )

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

For more detail, please check optimize and SearchSpec definitions.

Development

The project is managed by uv

Metadata

Release files for optuna-async-helper 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for optuna-async-helper 0.7.1
File Size Uploaded Provenance
optuna_async_helper-0.7.1.tar.gz 5.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for optuna-async-helper 0.7.1
File Interpreter ABI Platform
optuna_async_helper-0.7.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / optuna_async_helper-0.7.1.tar.gz

Download URL optuna_async_helper-0.7.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
89fc577b1217f133dbd0f742d5a2363be5d65e93a7906ff6cb942f083e214965
BLAKE2b-256 checksum
How to use checksums
b2a68d2ffa18170fef22a869d240ca1ae4031ce945808d8300a7c6a5c8c77ee4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Release files / optuna_async_helper-0.7.1-py3-none-any.whl

Download URL optuna_async_helper-0.7.1-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
217c0bf865673b0a62b267ab9842d3989b796f84a426bb50ff12ab4bbd64d3ac
BLAKE2b-256 checksum
How to use checksums
111baf15edbf70855404fd3ca1cd322cc8c3912654f7b66155e53fa47fb5ca86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Security for optuna-async-helper 0.7.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page