Easy hyperparameter optimization and automatic result saving across machine learning algorithms and libraries
Project description
HyperparameterHunter
====================
HyperparameterHunter provides wrappers for executing machine learning algorithms that
automatically save the testing conditions/hyperparameters, results, predictions, and
other data for a wide range of algorithms from many different libraries in a unified
format. HyperparameterHunter aims to simplify the experimentation and hyperparameter
tuning process by allowing you to spend less time doing the annoying tasks, and more time
doing the important ones.
Features
--------
* Truly informed hyperparameter optimization that automatically uses past Experiments
* Eliminate boilerplate code for cross-validation loops, predicting, and scoring
* Stop worrying about keeping track of hyperparameters, scores, or re-running the same Experiments
Getting Started
---------------
Set up an Environment to organize Experiments and Optimization
```python
from hyperparameter_hunter import Environment, CrossValidationExperiment
import pandas as pd
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import StratifiedKFold
from xgboost import XGBClassifier
data = load_breast_cancer
df = pd.DataFrame(data=data.data, columns=data.feature_names)
df['target'] = data.target
env = Environment(
train_dataset=df,
root_results_path='path/to/results/directory',
metrics_map=['roc_auc_score'],
cross_validation_type=StratifiedKFold,
cross_validation_params=dict(n_splits=5, shuffle=2, random_state=32)
)
```
Individual Experimentation
```python
experiment = CrossValidationExperiment(
model_initializer=XGBClassifier,
model_init_params=dict(objective='reg:linear', max_depth=3, subsample=0.5)
)
```
Hyperparameter Optimization
```python
from hyperparameter_hunter import BayesianOptimization, Real, Integer, Categorical
optimizer = BayesianOptimization(
iterations=100, read_experiments=True, dimensions=[
Integer(name='max_depth', low=2, high=20),
Real(name='learning_rate', low=0.0001, high=0.5),
Categorical(name='booster', categories=['gbtree', 'gblinear', 'dart'])
]
)
optimizer.set_experiment_guidelines(
model_initializer=XGBClassifier,
model_init_params=dict(n_estimators=200, subsample=0.5, learning_rate=0.1)
)
optimizer.go()
```
Plenty of examples for different libraries, and algorithms, as well as more advanced
HyperparameterHunter features can be found in the
[examples](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples)
directory.
Tested Libraries
----------------
* [Keras](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/keras_example.py)
* [scikit-learn](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/sklearn_example.py)
* [LightGBM](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/lightgbm_example.py)
* [CatBoost](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/catboost_example.py)
* [XGBoost](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/simple_example.py)
* [rgf_python](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/rgf_example.py)
* ... More on the way
Installation
------------
====================
HyperparameterHunter provides wrappers for executing machine learning algorithms that
automatically save the testing conditions/hyperparameters, results, predictions, and
other data for a wide range of algorithms from many different libraries in a unified
format. HyperparameterHunter aims to simplify the experimentation and hyperparameter
tuning process by allowing you to spend less time doing the annoying tasks, and more time
doing the important ones.
Features
--------
* Truly informed hyperparameter optimization that automatically uses past Experiments
* Eliminate boilerplate code for cross-validation loops, predicting, and scoring
* Stop worrying about keeping track of hyperparameters, scores, or re-running the same Experiments
Getting Started
---------------
Set up an Environment to organize Experiments and Optimization
```python
from hyperparameter_hunter import Environment, CrossValidationExperiment
import pandas as pd
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import StratifiedKFold
from xgboost import XGBClassifier
data = load_breast_cancer
df = pd.DataFrame(data=data.data, columns=data.feature_names)
df['target'] = data.target
env = Environment(
train_dataset=df,
root_results_path='path/to/results/directory',
metrics_map=['roc_auc_score'],
cross_validation_type=StratifiedKFold,
cross_validation_params=dict(n_splits=5, shuffle=2, random_state=32)
)
```
Individual Experimentation
```python
experiment = CrossValidationExperiment(
model_initializer=XGBClassifier,
model_init_params=dict(objective='reg:linear', max_depth=3, subsample=0.5)
)
```
Hyperparameter Optimization
```python
from hyperparameter_hunter import BayesianOptimization, Real, Integer, Categorical
optimizer = BayesianOptimization(
iterations=100, read_experiments=True, dimensions=[
Integer(name='max_depth', low=2, high=20),
Real(name='learning_rate', low=0.0001, high=0.5),
Categorical(name='booster', categories=['gbtree', 'gblinear', 'dart'])
]
)
optimizer.set_experiment_guidelines(
model_initializer=XGBClassifier,
model_init_params=dict(n_estimators=200, subsample=0.5, learning_rate=0.1)
)
optimizer.go()
```
Plenty of examples for different libraries, and algorithms, as well as more advanced
HyperparameterHunter features can be found in the
[examples](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples)
directory.
Tested Libraries
----------------
* [Keras](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/keras_example.py)
* [scikit-learn](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/sklearn_example.py)
* [LightGBM](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/lightgbm_example.py)
* [CatBoost](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/catboost_example.py)
* [XGBoost](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/simple_example.py)
* [rgf_python](https://github.com/HunterMcGushion/hyperparameter_hunter/blob/master/examples/rgf_example.py)
* ... More on the way
Installation
------------
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
Built Distribution
Close
Hashes for hyperparameter_hunter-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a2a2eba2a6eaf45a4225a85c64f89b2c4f48b98fe1e4dd1560987ae1b3d8139 |
|
MD5 | 4547b43847f5f99f648aafb1f325fa8b |
|
BLAKE2b-256 | aed2adfb1cdd24c8c123bd78c3c67026ada07fba4d2d8c1010784fae1d202b4e |
Close
Hashes for hyperparameter_hunter-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed43365b4703858d0e436f17cb7d6940e1c096df7566aa397145b720d02e3183 |
|
MD5 | 395fc2cc91464cb7214583008b62e4e1 |
|
BLAKE2b-256 | 4adcd109ffc3e7e51ac9a8e3dad9e8dbfbdd6b7c13fee06aca122cc74d356cb4 |