Homing Search
Homing Search is a python module for smart hyperparameter optimization in Python.
Why
Typically for hyperparameter optimization programmers use sklearn's GridSearch or RandomSearch algorithms.
GridSearch has the advantage of being exhaustive, and the disadvantage of taking impractically long for large search spaces.
RandomSearch has the advantage of being managable to a timeframe of the developer's choosing, but the disadvantage of being non-adaptable to results as they are discovered.
Homing Search seeks to bring together the best of both of these two approaches and to improve upon them by adding adaptation based on the results discovered so far.
The library is written to be compatible with multiple Machine Learning Libaries (e.g. Keras, Sci-kit Learn, Pytorch), however to minimize required dependencies, each libary will have its own forked package.
Features
- You provide a time-limit within which it is guaranteed to finish.
- If the search area is small enough, it will perform an exhaustive grid search in approximately the same time as a GridSearch. There is no reason NOT to choose Homing Search in preference to GridSearch.
- If the search area is very large, it will produce better results than both GridSearch and RandomSearch.
- Backend agnostic. Currently supporting functions for Keras are provided to process pandas dataframes into tensorflow datasets, in the future additional supporting functions for sklearn and pytorch databunch will be added.
Getting started
Install Homing Search from PyPI
$ pip install homing-search-keras
To run your first example:
Write a build_fn that takes a combination of parameters as inputs and a compiled model as output
- build_fn (**kwargs)
Define a dictionary of parameters to search. values provided as lists are statically searched, but values of int or float provided as sets are ranged (ie when a promising result is found, it will begin exploring other values near to the mean best score)
params = {
'layer1_dim':{800, 2000, 4000},
'layer2_dim':{100,300,500},
'layer1_dropout':{0.1, 0.3, 0.5},
'layer2_dropout':{0.1, 0.3, 0.5},
'activation':['relu', 'tanh', 'softplus', 'elu'],
'optimizer':['Adagrad','SGD','RMSprop','adam', 'Adadelta'],
'learning_rate':{0.1, 0.01},
'batch_size': [64, 128, 256, 512],
}
repeats = 2 # number of times to repeat each parameter option to get an average score
epochs = 200
time_limit = 30 # will optimize search to end no later than 30 minutes
NN_builder # a function that
from homing_search import HomingSearchKeras
hsk = HomingSearchKeras(build_fn=build_fn, data=pandas_df, label='price', batch_size=256, save_tf_logs=False)
hsk.start(params, repeats, epochs, time_limit)
Contributing
If you're a developer and wish to contribute:
-
Create an account on GitHub if you do not already have one.
-
Fork the project repository: click on the ‘Fork’ button near the top of the page. This creates a copy of the code under your account on the GitHub user account. For more details on how to fork a repository see this guide.
-
Clone your fork of the homing_search repo from your GitHub account to your local disk:
$ git clone https://github.com/<your github username>/homing_search.git
$ cd homing_search
Metadata
Release files for homing-search-keras 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| homing-search-keras-0.0.6.tar.gz | 9.3 kB | Without provenance | Details for homing-search-keras-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| homing_search_keras-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for homing_search_keras-0.0.6-py3-none-any.whl |
Total release size: 20.1 kB
Release files / homing-search-keras-0.0.6.tar.gz
| Download URL | homing-search-keras-0.0.6.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
822a039ab8973619ac0fdb2856101179f82203d163917f7092babe7d722af082
|
|
BLAKE2b-256 checksum How to use checksums |
fcb7e01a48a985089eba1abc5cc44d5cbf033f071fb5b1a16b6f51a52dee894c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.7.9
|
Release files / homing_search_keras-0.0.6-py3-none-any.whl
| Download URL | homing_search_keras-0.0.6-py3-none-any.whl |
|---|---|
| Size | 10.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad6a9eb3a86f10fe29dba11a5989a8057b2f0c4760f0972ec3d88b79559cbb38
|
|
BLAKE2b-256 checksum How to use checksums |
3f327186f1e5807fa59f2f33e24bbb7e216d310028034fbd97f0dc6c61c706af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.7.9
|
Security for homing-search-keras 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.