OptunaTuner
- class lightautoml.ml_algo.tuning.optuna.OptunaTuner(timeout=1000, n_trials=100, direction='maximize', fit_on_holdout=True, random_state=42, fail_tolerance=0.5)[source]
Bases:
ParamsTunerWrapper for optuna tuner.
- Parameters:
direction (
Optional[str]) – Direction of optimization. Setminimizefor minimization andmaximizefor maximization.fit_on_holdout (
bool) – Will be used holdout cv-iterator.random_state (
int) – Seed for optuna sampler.fail_tolerance (
float) – the maximum allowed percentage of failed tuner trials. Exception will be thrown after crossing the threshold value.
- fit(ml_algo, train_valid_iterator=None)[source]
Tune model.
- Parameters:
ml_algo (
TypeVar(TunableAlgo, bound=MLAlgo)) – Algo that is tuned.train_valid_iterator (
Optional[TrainValidIterator]) – Classic cv-iterator.
- Return type:
Tuple[Optional[TypeVar(TunableAlgo, bound=MLAlgo)],Optional[LAMLDataset]]- Returns:
Tuple (None, None) if an optuna exception raised or
fit_on_holdout=Trueandtrain_valid_iteratoris notHoldoutIterator. Tuple (MlALgo, preds_ds) otherwise.