Machine learning hyperparameter optimiser using the Bayesian model
Project description
mihkelBayesian
This is a Bayesian optimizer created to optimize hyperparameters different functions and machine learning.
Installation
Run the following command: pip install mihkelBayesian
How to mihkelBayesian
Choosing the function to evaluate
Open functions.py to see all currently available functions. Each function takes an array XY that is automatically generated by the optimizer and a list of function constants that the function uses. Use one of the pre-existing functions or write your own function that the optimizer will call upon. Custom function can be analytical, machine learning etc.
Optimizing hyperparameters
In order to optimize 2 hyperparameters you need to:
import optimize.run(evaluateFunction, functionConstants, n_iterations,bounds), where
evaluateFunction is a string of the same name as the function you wish to evaluate in functions.py. functionConstans is a list of constants you wish to apply to the evaluateFunction n_iterations is how many measurements of the function the optimizer is allower to make bounds is a (1 x 2) shape numpy array that limits the searchspace in the form of [[x1min,x1max],[x2min,x2max]]
Function run() outputs the smallest function value and the hyperparameter pair corresponding to that value.
Testing
Pytest is used to test the code. All tests are located in the 'tests' folder.To run the tests, execute:
pytest
Notes
You can vary the hyperparameters of the optimizer in order to get better results.
More than 500 no_iterations takes long time to compute. Often no more than 300 iterations are needed.
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
Hashes for mihkelBayesian-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac03b9bd99cdb55bd1513142ebe80f9a5a0f49cd3a0b26a16d13a7baebb4d4ae |
|
MD5 | 9dab2cf8bc11977f0c13e52d39aab6b3 |
|
BLAKE2b-256 | 51a5cb182f241de78dcb7b0b44b010fffd3d8264b4b68aa3775f95acd36c0867 |