optuna.trial.FixedTrial¶
-
class
optuna.trial.
FixedTrial
(params, number=0)[source]¶ A trial class which suggests a fixed value for each parameter.
This object has the same methods as
Trial
, and it suggests pre-defined parameter values. The parameter values can be determined at the construction of theFixedTrial
object. In contrast toTrial
,FixedTrial
does not depend onStudy
, and it is useful for deploying optimization results.Example
Evaluate an objective function with parameter values given by a user.
import optuna def objective(trial): x = trial.suggest_uniform("x", -100, 100) y = trial.suggest_categorical("y", [-1, 0, 1]) return x ** 2 + y assert objective(optuna.trial.FixedTrial({"x": 1, "y": 0})) == 1
Note
Please refer to
Trial
for details of methods and properties.- Parameters
params – A dictionary containing all parameters.
number – A trial number. Defaults to
0
.
Methods
report
(value, step)set_system_attr
(key, value)set_user_attr
(key, value)should_prune
()suggest_categorical
(name, choices)suggest_discrete_uniform
(name, low, high, q)suggest_float
(name, low, high, *[, step, log])suggest_int
(name, low, high[, step, log])suggest_loguniform
(name, low, high)suggest_uniform
(name, low, high)Attributes
datetime_start
distributions
number
params
system_attrs
user_attrs