Welcome to OptunaHub’s documentation!

OptunaHub is a registry of third-party packages designed for Optuna. It allows users to share and discover Optuna packages that are not included in the official Optuna distribution. The optunahub library provides Python APIs to load and use packages from the OptunaHub registry.

If you are interested in registering your own features in OptunaHub, please visit the optunahub-registry repository and submit a pull request there. More details are available in the optunahub-registry tutorial.

Usage

Install the optunahub package.

pip install optunahub

Load the package you want from the OptunaHub registry. In the next example code, you will load the AutoSampler from the samplers/auto_sampler package. The details for AutoSampler can be found in this article.

import optuna
import optunahub


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

   return x**2 + y**2


mod = optunahub.load_module("samplers/auto_sampler")

study = optuna.create_study(sampler=mod.AutoSampler())
study.optimize(objective, n_trials=10)

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

Now that you’ve successfully loaded a package from the OptunaHub registry, you can start using optunahub in your optimization! Get ready to explore the most suitable packages for your problems in the OptunaHub registry.