A hyperparameter optimization framework via optuna.
Project description
optuna-learn
Tuning hyper-parameters based on Optuna is as easy as using scikit-learn.
:hourglass_flowing_sand: Dependencies
optuna-learn requires:
- python >= 3.6
- scikit-learn
- optuna
:zap: Quick Start
from lightgbm import LGBMClassifier
from optlearn.opt import OptunaSearch
from sklearn.datasets import load_iris
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
opt = OptunaSearch(
model=LGBMClassifier,
optimize_direction='minimize',
params_dict={
'n_estimators': ['categorical', 100, 200, 300, 500],
'reg_alpha': ['float', 0.001, 10, False],
'reg_lambda': ['float', 0.001, 100, False],
'num_leaves': ['int', 2, 256],
}
)
opt.fit(X_train, y_train)
y_pred = opt.predict(X_test)
accuracy_score(y_test, y_pred)
>>> 0.9967924528301886
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
optuna-learn-0.1.0.tar.gz
(8.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file optuna-learn-0.1.0.tar.gz.
File metadata
- Download URL: optuna-learn-0.1.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
281f039a87614603a620be242a03d2c37cc3aad009eb78536bdd8d83ed94ac48
|
|
| MD5 |
7fced81e56074bb04762cd42651b7ee0
|
|
| BLAKE2b-256 |
949043518808bb5ce6cc7880e99a3754726ab22cb6f59d1a15314f68373c4d48
|
File details
Details for the file optuna_learn-0.1.0-py3-none-any.whl.
File metadata
- Download URL: optuna_learn-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a87f0f0297ae371fd3196d863bba9ba41b3930fedba212edfe34cc2f8a03777
|
|
| MD5 |
2994ed5fcb5165b1f50d49f1a1bd289e
|
|
| BLAKE2b-256 |
b88b8c1685137c85ccf9d7f553698a2f8a04a5c1d8c86f0cf1a98687dc1e8e92
|