OptunaHub / Grid Search

Sampler using grid search.

Package: samplers/grid_search
Author: Optuna team
License: MIT License
Verified Optuna version: 3.6.1

Class or Function Names

Example

import optuna
from optuna.samplers import GridSampler


def objective(trial):
    x = trial.suggest_float("x", -100, 100)
    y = trial.suggest_int("y", -100, 100)
    return x**2 + y**2


search_space = {"x": [-50, 0, 50], "y": [-99, 0, 99]}
sampler = GridSampler(search_space)
study = optuna.create_study(sampler=sampler)
study.optimize(objective)

Others

See the documentation for more details.