Announcing OptunaHub 0.1.0-β

Yoshihiko Ozaki
Optuna
Published in
4 min read1 day ago

Introduction

Optuna is one of the most popular OSS for black-box optimization in the world today. It has over 2 million downloads per month, more than 10,000 stars on GitHub, and is used in over 15,000 software projects.

Today, the Optuna team released the beta version of OptunaHub, the feature-sharing platform for Optuna. OptunaHub collects features that can be freely used by Optuna users, and all researchers and developers can register the features they implement. The beta version of OptunaHub is now ready to accept contributions from all over the world. This article introduces you to OputunaHub and explains how to register your features in OptunaHub.

TL;DR

  • OptunaHub is a platform for sharing features developed by contributors around the world for Optuna. Anyone can easily use and register features!
  • We are actively seeking feature registration in OptunaHub; please register!

OptunaHub

OptunaHub is a platform for sharing features developed for Optuna by contributors worldwide. Researchers and developers of black-box optimization can register their developed features in OptunaHub, and users can easily use these features with the same interface as the features in Optuna. As of July 2024, OptunaHub supports the registration and use of algorithms such as Sampler and Pruner, as well as visualization functions.

When you access the top page of OptunaHub (https://hub.optuna.org/), a list of registered packages is displayed (Figure 1). Packages are Python modules containing features implemented for Optuna. Here, you can search for packages that provide desired features using keywords and tags. By clicking on the name of the package, you can move to the details page and check how to use and examples of the package (Figure 2).

Figure 1: OptunaHub top page
Figure 1: OptunaHub top page
Figure 2: Example of detail page
Figure 2: Example of details page

To use a package on OptunaHub, first install the optunahub library.

pip install optunahub

You can load the module by passing the package name to the optuna.load_module function provided by the library. The package name is in the form of category/user_defined_name, which can be checked in the Package column on the details page. Then, just like in Optuna itself, you can use the desired function implemented in the module (in this example, SimulatedAnnealingSampler).

import optuna
import optunahub


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)

For more detailed information on the optunahub library, please check the official documentation.

Registering Your Package with OptunaHub

All packages in OptunaHub are managed in a repository called optunahub-registry. Under the package directory of this repository, there are directories corresponding to categories such as Sampler, Pruner, and Visualization, and individual packages are placed in each. For example, the entity of the Simulated Annealing Sampler package used in the previous example is optunahub-registry/package/samplers/simulated_annealing.

To register a new package in OptunaHub, fork the optunahub-registry repository, implement a package with a structure like the following including algorithm, README, and license (note: optional elements are omitted), and create a pull request to the optunahub-registry repository.

package
└── category (e.g. samplers, pruners, and visualization)
└── YOUR_PACKAGE_NAME (you need to create this directory and its contents)
├── README.md
├── LICENSE
├── __init__.py
└── YOUR_ALGORITHM_NAME.py

When a pull request is created, the Optuna team conducts a simple check and merges it immediately. The code review in optunahub-registry checks for format deficiencies and security threats, among other simple matters. After the pull request is merged, the corresponding package will be displayed on the OptunaHub website within about 1 hour. The official tutorial explains the package registration process in more detail.

OptunaHub is actively accepting registrations of recently published cutting-edge methods and methods specialized for specific applications, which were difficult to support officially in Optuna. For example, the Evolutionary LLM Merge Sampler package (Figure 3) provides an implementation of the merger method for large language models proposed in a paper published in 2024.

Figure 3: Evolutionary LLM Merge Sampler
Figure 3: Evolutionary LLM Merge Sampler

OptunaHub is looking forward to your contributions.

Wrapping Up

With the release of the beta version of OptunaHub, we have introduced OptunaHub and explained how to register features in OptunaHub. We are committed to broadly contributing to problem-solving by black-box optimization and developing the research and development community through OSS development. We look forward to your continued support.

Access OptunaHub
https://hub.optuna.org/

--

--