Как избавится от журнала прогонов в OptunaSearchCV
# Инициализируйте класс
oscv = OptunaSearchCV(
model,
oscv_parameters,
scoring='roc_auc',
cv=5,
n_trials=20,
random_state=RANDOM_STATE
)
# запускаем поиск гиперпараметров
oscv.fit(X_train, y_train)
Выдает:
[I 2024-06-19 13:55:20,561] A new study created in memory with name: no-name-2f23c0a4-2bf1-4372-9ebd-21c5938aeddf
[I 2024-06-19 13:55:20,599] Trial 0 finished with value: 0.8595816639904635 and parameters: {'min_samples_split': 3, 'min_samples_leaf': 5, 'max_depth': 2}. Best is trial 0 with value: 0.8595816639904635.
[I 2024-06-19 13:55:20,640] Trial 1 finished with value: 0.8890406573613261 and parameters: {'min_samples_split': 3, 'min_samples_leaf': 3, 'max_depth': 3}. Best is trial 1 with value: 0.8890406573613261.
[I 2024-06-19 13:55:20,677] Trial 2 finished with value: 0.8595816639904635 and parameters: {'min_samples_split': 2, 'min_samples_leaf': 1, 'max_depth': 2}. Best is trial 1 with value: 0.8890406573613261.
[I 2024-06-19 13:55:20,729] Trial 3 finished with value: 0.8939105840597309 and parameters: {'min_samples_split': 3, 'min_samples_leaf': 2, 'max_depth': 5}. Best is trial 3 with value: 0.8939105840597309.
[I 2024-06-19 13:55:20,771] Trial 4 finished with value: 0.8890406573613261 and parameters: {'min_samples_split': 4, 'min_samples_leaf': 2, 'max_depth': 3}. Best is trial 3 with value: 0.8939105840597309.
[I 2024-06-19 13:55:20,824] Trial 5 finished with value: 0.8933464160098274 and parameters: {'min_samples_split': 3, 'min_samples_leaf': 5, 'max_depth': 5}. Best is trial 3 with value: 0.8939105840597309.
[I 2024-06-19 13:55:20,866] Trial 6 finished with value: 0.8890406573613261 and parameters: {'min_samples_split': 3, 'min_samples_leaf': 5, 'max_depth': 3}. Best is trial 3 with value: 0.8939105840597309.
[I 2024-06-19 13:55:20,904] Trial 7 finished with value: 0.8595816639904635 and parameters: {'min_samples_split': 5, 'min_samples_leaf': 5, 'max_depth': 2}. Best is trial 3 with value: 0.8939105840597309.
[I 2024-06-19 13:55:20,958] Trial 8 finished with value: 0.8933464160098274 and parameters: {'min_samples_split': 3, 'min_samples_leaf': 5, 'max_depth': 5}. Best is trial 3 with value: 0.8939105840597309.
[I 2024-06-19 13:55:21,008] Trial 9 finished with value: 0.8967430049890102 and parameters: {'min_samples_split': 4, 'min_samples_leaf': 1, 'max_depth': 4}. Best is trial 9 with value: 0.8967430049890102.
[I 2024-06-19 13:55:21,071] Trial 10 finished with value: 0.8967430049890102 and parameters: {'min_samples_split': 5, 'min_samples_leaf': 1, 'max_depth': 4}. Best is trial 9 with value: 0.8967430049890102.
[I 2024-06-19 13:55:21,133] Trial 11 finished with value: 0.8967430049890102 and parameters: {'min_samples_split': 5, 'min_samples_leaf': 1, 'max_depth': 4}. Best is trial 9 with value: 0.8967430049890102.
[I 2024-06-19 13:55:21,197] Trial 12 finished with value: 0.8967430049890102 and parameters: {'min_samples_split': 4, 'min_samples_leaf': 2, 'max_depth': 4}. Best is trial 9 with value: 0.8967430049890102.
[I 2024-06-19 13:55:21,261] Trial 13 finished with value: 0.8967430049890102 and parameters: {'min_samples_split': 5, 'min_samples_leaf': 1, 'max_depth': 4}. Best is trial 9 with value: 0.8967430049890102.
[I 2024-06-19 13:55:21,326] Trial 14 finished with value: 0.8967430049890102 and parameters: {'min_samples_split': 4, 'min_samples_leaf': 3, 'max_depth': 4}. Best is trial 9 with value: 0.8967430049890102.
[I 2024-06-19 13:55:21,388] Trial 15 finished with value: 0.8967430049890102 and parameters: {'min_samples_split': 5, 'min_samples_leaf': 1, 'max_depth': 4}. Best is trial 9 with value: 0.8967430049890102.
[I 2024-06-19 13:55:21,445] Trial 16 finished with value: 0.8890406573613261 and parameters: {'min_samples_split': 4, 'min_samples_leaf': 2, 'max_depth': 3}. Best is trial 9 with value: 0.8967430049890102.
[I 2024-06-19 13:55:21,514] Trial 17 finished with value: 0.8935852323756261 and parameters: {'min_samples_split': 5, 'min_samples_leaf': 4, 'max_depth': 5}. Best is trial 9 with value: 0.8967430049890102.
[I 2024-06-19 13:55:21,578] Trial 18 finished with value: 0.8967430049890102 and parameters: {'min_samples_split': 4, 'min_samples_leaf': 1, 'max_depth': 4}. Best is trial 9 with value: 0.8967430049890102.
[I 2024-06-19 13:55:21,637] Trial 19 finished with value: 0.8890406573613261 and parameters: {'min_samples_split': 2, 'min_samples_leaf': 4, 'max_depth': 3}. Best is trial 9 with value: 0.8967430049890102.
Как это убрать? Все работает, нужно исключительно в эстетических соображениях.
Ответы (1 шт):
Автор решения: GravyTalk
→ Ссылка
https://optuna.readthedocs.io/en/v2.0.0/reference/generated/optuna.integration.OptunaSearchCV.html
Обычно за скрытие сообщений отвечает параметр verbose.