Skip to content

optuna/optunahub

 
 

Repository files navigation

OptunaHub

Python GitHub license

NOTICE: OptunaHub is under development and all features are experimental. API may change in the future.

Python Library to use packages published in OptunaHub Registry.

Install

Install optunahub package.

pip install optunahub

Documentation

Example

import optunahub
import optuna


def objective(trial: optuna.Trial) -> float:
    x = trial.suggest_float("x", 0, 1)

    return x


if __name__ == "__main__":
    mod = optunahub.load_module("samplers/simulated_annealing")

    sampler = mod.SimulatedAnnealingSampler()
    study = optuna.create_study(sampler=sampler)
    study.optimize(objective, n_trials=20)

    print(study.best_trial.value, study.best_trial.params)