|
|
|
|
@ -68,6 +68,7 @@ import mlflow.sklearn
|
|
|
|
|
import mlxtend.feature_selection
|
|
|
|
|
import mlxtend.plotting
|
|
|
|
|
import optuna
|
|
|
|
|
import optuna.samplers
|
|
|
|
|
import sklearn.compose
|
|
|
|
|
import sklearn.ensemble
|
|
|
|
|
import sklearn.metrics
|
|
|
|
|
@ -714,8 +715,9 @@ def regressor_hyperparams_objective(trial):
|
|
|
|
|
# optuna study:
|
|
|
|
|
|
|
|
|
|
# %%
|
|
|
|
|
optuna_study = optuna.create_study(direction='minimize')
|
|
|
|
|
optuna_study.optimize(regressor_hyperparams_objective, n_trials=64, timeout=120.)
|
|
|
|
|
optuna_sampler = optuna.samplers.TPESampler(seed=0x0A1C)
|
|
|
|
|
optuna_study = optuna.create_study(sampler=optuna_sampler, direction='minimize')
|
|
|
|
|
optuna_study.optimize(regressor_hyperparams_objective, n_trials=24)
|
|
|
|
|
|
|
|
|
|
# %% [markdown]
|
|
|
|
|
# Количество выполненных trials:
|
|
|
|
|
@ -724,19 +726,13 @@ optuna_study.optimize(regressor_hyperparams_objective, n_trials=64, timeout=120.
|
|
|
|
|
len(optuna_study.trials)
|
|
|
|
|
|
|
|
|
|
# %% [markdown]
|
|
|
|
|
# Лучшие найдённые гиперпараметры (недетерминированы, один из результатов записан явно):
|
|
|
|
|
# Лучшие найдённые гиперпараметры:
|
|
|
|
|
|
|
|
|
|
# %%
|
|
|
|
|
optuna_study.best_params
|
|
|
|
|
repr(optuna_study.best_params)
|
|
|
|
|
|
|
|
|
|
# %%
|
|
|
|
|
regressor_best_params = {
|
|
|
|
|
#'n_estimators': 51,
|
|
|
|
|
'n_estimators': 50,
|
|
|
|
|
'max_depth': 11,
|
|
|
|
|
#'max_features': 0.44655290756636146,
|
|
|
|
|
'max_features': 0.45,
|
|
|
|
|
}
|
|
|
|
|
regressor_best_params = dict(optuna_study.best_params.items())
|
|
|
|
|
|
|
|
|
|
# %% [markdown]
|
|
|
|
|
# Составной пайплайн:
|
|
|
|
|
|