From c16caf2e6ad537336894ee9a170046ed51625200 Mon Sep 17 00:00:00 2001 From: syropiatovvv Date: Sat, 1 Nov 2025 21:21:52 +0300 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=20optuna=20=D0=B2=20=D0=B1?= =?UTF-8?q?=D0=BB=D0=BE=D0=BA=D0=BD=D0=BE=D1=82=D0=B5=20research=20=D0=BE?= =?UTF-8?q?=D0=BF=D1=86=D0=B8=D0=BE=D0=BD=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B?= =?UTF-8?q?=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- research/research.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/research/research.py b/research/research.py index 9d6741b..24d2cca 100644 --- a/research/research.py +++ b/research/research.py @@ -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] # Составной пайплайн: