OptunaHub, a Feature-Sharing Platform for Optuna, Now Available in Official Release!

Yoshihiko Ozaki
Optuna
Published in
5 min readAug 30, 2024

TL;DR

We are pleased to announce the official release of OptunaHub (https://hub.optuna.org/), a feature-sharing platform for Optuna.

  • OptunaHub now includes a variety of new algorithms, such as one proposed at this year’s top conference (e.g. CatCMA) and one that won a competition (e.g. HEBO).
  • Not only optimization algorithms, but also visualization algorithms for analysis can be available in OptunaHub.
  • You only need to search for the desired function on the OptunaHub website and call the optunahub.load_module function in your code to incorporate it.

Introducing OptunaHub

OptunaHub is a platform for sharing algorithms in Optuna, a powerful and flexible hyperparameter optimization framework. Since the beta version was released in July, the Optuna team has continued to improve the service with developers, receiving more than 10 contributions. Today, the official version of OptunaHub was released.

OptunaHub: A Feature-Sharing Platform for Optuna

Below, we will explain the values that OptunaHub provides to users from four perspectives.

A wide range of optimization algorithms are available, from the latest to the well-known

In OptunaHub, a wide range of optimization algorithms are available. In particular, state-of-the-art (SOTA) methods such as “HEBO” and “CatCMA”, which have only recently been proposed, can be easily used with the Optuna interface. Previously, in order to use such methods, users had to implement each algorithm themselves, but now, by using OptunaHub, anyone can easily try out these methods. Of course, the methods available on OptunaHub are not limited to the latest ones, and Optuna implementations of algorithms such as classical experimental design (UniformDesignSampler) are also available.

Providing packages specialized for specific domains and applications

OptunaHub also has packages specialized for specific domains and applications. For example, algorithms specialized for materials and chemical domains (BBO-Rietveld) and algorithms specialized for merging large language models (EvoMergeSampler) exist. These packages provide not only the Optuna implementation of optimization algorithms but also various utilities for solving the target problems, allowing users to solve problems with significantly less effort than if they were to implement all the mechanisms from scratch.

Frequent feature updates

In OptunaHub, feature additions are reflected in the platform as soon as the corresponding pull requests are merged. In just one month since the beta version was released, more than ten optimization algorithms and visualization functions have been added. If the feature you want has not yet been provided, you can request it from contributors. Frequent feature updates also allow quick feature improvements and bug fixes.

Practical Visualization

Finally, OptunaHub also provides packages for users to visualize algorithm execution times and other metrics, allowing users to better understand the optimization process, analyze optimization results, and refine algorithm choices.

As described above, OptunaHub offers many benefits as a platform for efficient problem solving through black-box optimization. Since anyone can use it easily, we highly recommend that you try OptunaHub.

How to Use OptunaHub

Installation

First, you need to install the optunahub Python library.

pip install optunahub

OptunaHub is now ready to use.

Find optimization algorithms and visualization features on the website

OptunaHub is a simple website that mainly consists of two types of pages. Here, we explain how to find and use packages.

Search for packages on the top page

When you access the top page, you will see a list of all the packages available in OptunaHub.

By entering an algorithm name or keyword in the text box, you can filter the results to only relevant packages. Each package has a thumbnail and a brief description, and you can click to view its details page.

The image below is an example of filtering packages with the keyword “Bayesian”. Only packages related to Bayesian optimization are displayed then.

OptunaHub: Package Search

Learn how to use the package on the details page

The details page provides detailed explanations and usage of each algorithm and visualization function, including how to install dependent libraries and sample code.

By referring to the sample code, you can learn how to actually use the algorithm. For example, the CatCMA Sampler details page below has sample code in the Example section. You can also try out the sample code in Google Colab from your browser by pressing the Open in Colab button.

OptunaHub: Package Details

In this Google Colab notebook, you can execute the sample code for CatCmaSampler, from setting up the environment to defining the objective function, running the optimization, and visualizing the results.

Google Colab Notebook for CatCmaSampler

Here, we will introduce a simple example of using the OptunaHub library and CatCmaSampler. The following sample code loads CatCmaSampler and optimizes a simple quadratic function that includes a categorical variable.

import optuna
import optunahub

def objective(trial: optuna.Trial) -> float:
x1 = trial.suggest_float("x1", -10, 10)
x2 = trial.suggest_float("x2", -10, 10)
c = trial.suggest_categorical("c", [-5, 0, 5])
return x1**2 + x2**2 + c

mod = optunahub.load_module("samplers/catcma")
study = optuna.create_study(sampler=mod.CatCmaSampler())
study.optimize(objective, n_trials=20)

The important thing to note is optunahub.load_module("samplers/catcma"). load_module is a function that downloads and loads the desired module (here, “samplers/catcma”) from OptunaHub. This allows you to use CatCmaSampler. The remaining optimization steps are the same as when using Optuna’s built-in sampler.

Now, you are ready to try applying OptunaHub’s algorithms and visualizations to your problems!

Tips: Reload Packages

Packages loaded with OptunaHub are cached locally. Therefore, packages are downloaded only the first time, and from the second time onwards they are loaded from the cache. Package caching has the advantage of speeding up subsequent loads and allowing offline use. If there is an update to a package, you can get the latest version by setting the force_reload option of optunahub.load_moduleto True.

mod = optunahub.load_module("samplers/catcma", force_reload=True)

Wrapping Up

We believe that the official release of OptunaHub is valuable for everyone passionate about black-box optimization. We are confident that this platform will benefit the community and continue evolving. We hope you will use OptunaHub and explore the black-box optimization world!

For potential contributors interested in registering OptunaHub packages

In this article, we have introduced how to use packages in OptunaHub. Developers can also register packages they have created in OptunaHub and make them available to users. In last month’s OptunaHub 0.1.0-β release blog, we introduced how to register packages in OptunaHub, so if you are interested in registering your package with the platform, please take a look!

--

--