« Back to top page

Partial Fixed Sampler

Sampler with partially fixed parameters.

Class or Function Names

  • PartialFixedSampler

Example

import optuna
from optuna.samplers import PartialFixedSampler


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


tpe_sampler = optuna.samplers.TPESampler()
fixed_params = {"y": 0}
partial_sampler = PartialFixedSampler(fixed_params, tpe_sampler)

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

Others

See the documentation for more details.

Package
samplers/partial_fixed
Author
Optuna team
License
MIT License
Verified Optuna version
  • 3.6.1
Last update
2024-07-05