optuna.trial.FixedTrial¶
-
class
optuna.trial.FixedTrial(params: Dict[str, Any], number: int = 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 theFixedTrialobject. In contrast toTrial,FixedTrialdoes 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
Trialfor details of methods and properties.- Parameters
params – A dictionary containing all parameters.
number – A trial number. Defaults to
0.
-
__init__(params: Dict[str, Any], number: int = 0) → None[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__(params[, number])Initialize self.
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_startdistributionsnumberparamssystem_attrsuser_attrs