Skip to main content

Hydra-SMAC 0.1.11

A minimal Python re-implementation of Hydra.

Getting started

pip install hydra-smac

Example

For more information on how to use Scenario objects, please refer to the SMAC documentation.

from ConfigSpace import Configuration, ConfigurationSpace, Float
from hydrasmac import Hydra
from smac import Scenario

instances = ["a", "b", "c"]
features = {"a": [0.0], "b": [1.0], "c": [2.0]}

cs = ConfigurationSpace()
cs.add_hyperparameters(
    [
        Float("x", (1.0, 5.0)),
        Float("y", (1.0, 5.0)),
        Float("z", (1.0, 5.0)),
    ]
)


def target_function(config: Configuration, instance: str, seed: int = 0) -> float:
    config_dict = config.get_dictionary()
    x, y, z = config_dict["x"], config_dict["y"], config_dict["z"]

    if instance == "a" and x < 2.5 and y > 2.5 and z > 2.5:
        return 0.001

    if instance == "b" and y < 2.5 and x > 2.5 and z > 2.5:
        return 0.01

    if instance == "c" and z < 2.5 and y > 2.5 and x > 2.5:
        return 0.1

    return 1


scenario = Scenario(
    configspace=cs,
    instances=instances,
    instance_features=features,
    n_trials=500,
)

hydra = Hydra(
    scenario,
    target_function,
    hydra_iterations=3,
    smac_runs_per_iter=1,
    incumbents_added_per_iter=1,
    stop_early=True,
)

portfolio = hydra.optimize()
print("====== Resulting portfolio ======")
print(portfolio)
print("=================================")

Metadata

Release files for hydra-smac 0.1.11

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

Source distribution (sdist)

Source distribution for hydra-smac 0.1.11
File Size Uploaded Provenance Actions
hydra-smac-0.1.11.tar.gz 8.9 kB Without provenance Details for hydra-smac-0.1.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hydra-smac 0.1.11
File Interpreter ABI Platform Actions
hydra_smac-0.1.11-py3-none-any.whl Python 3 none any Details for hydra_smac-0.1.11-py3-none-any.whl

Total release size: 18.3 kB

Release files / hydra-smac-0.1.11.tar.gz

Download URL hydra-smac-0.1.11.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7e2b8d83496f666265bf97dd64d7c7447783d99af783e4c0fd5ea824c165b09b
BLAKE2b-256 checksum
How to use checksums
e364c33ab9cc9a7671b3d0288f33742810d96b7470654147a6b8f145f2c1dd44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / hydra_smac-0.1.11-py3-none-any.whl

Download URL hydra_smac-0.1.11-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ba7653a8e0988ccf98256f46b8496a9c4c9a6ee86eca24718c84710a461964b
BLAKE2b-256 checksum
How to use checksums
3df624a617f8fdedd3fa6b5e5c8748cac94a199cf6d24cab2988a6d6f814f587
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for hydra-smac 0.1.11

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