This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
params = { | |
"objective": "binary", | |
"metric": "binary_logloss", | |
"verbosity": -1, | |
"boosting_type": "gbdt", | |
} | |
tuner = lgb.LightGBMTunerCV( | |
params, dtrain, verbose_eval=100, early_stopping_rounds=100 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import mlflow | |
import numpy as np | |
import sklearn.datasets | |
from sklearn.metrics import accuracy_score | |
from sklearn.model_selection import train_test_split | |
import optuna | |
import optuna.integration.lightgbm as lgb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import optuna | |
study = optuna.create_study( | |
storage="sqlite:///lgbtuner.db", study_name="parallel", load_if_exists=True | |
) | |
study.trials_dataframe().to_csv("parallel-result.csv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Optuna example that optimizes a classifier configuration for cancer dataset using LightGBM tuner. | |
In this example, we optimize the validation log loss of cancer detection. | |
You can execute this code directly. | |
$ python lightgbm_tuner_parallel.py [-p] | |
""" | |
import argparse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Optuna example that optimizes a simple quadratic function in parallel using joblib. | |
In this example, we optimize a simple quadratic function. We also demonstrate how to continue an | |
optimization and to use timeouts. | |
We have the following way to execute this example: | |
$ python quadratic_joblib_simple.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import sklearn.datasets | |
import sklearn.linear_model | |
import sklearn.model_selection | |
import optuna | |
class NaNValuePruner(optuna.pruners.BasePruner): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ... | |
def objective(trial): | |
... | |
alpha = trial.suggest_loguniform('alpha', 1e-5, 1e-1) | |
clf = sklearn.linear_model.SGDClassifier(alpha=alpha) | |
for step in range(100): | |
clf.partial_fit(train_x, train_y, classes=classes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import optuna | |
import sklearn | |
import sklearn.datasets | |
import sklearn.neural_network | |
def objective(trial): | |
# ネットワーク構造の決定 | |
n_layers = trial.suggest_int('n_layers', 1, 4) | |
layers = [] |
Settings: (sigopt/evalset/auc-test-suites)
- Problems: 38
- Metrics: best
Solver | Borda | Firsts |
---|---|---|
(a) optuna#tpe-faster | 0 | 37 |
(b) optuna#tpe-latest | 1 | 38 |