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
Optimizing hyperparameters
In order to optimize 2 hyperparameters you need to:
from mihkelBayesian import optimize
min_val, min_hyperparameters = optimize.run(evaluateFunction, functionConstants, n_iterations,bounds)
evaluateFunction - a string of the same name as the function you wish to evaluate in functions.py. functionConstans - a list of constants you wish to apply to the evaluateFunction n_iterations - how many measurements of the function the optimizer is allower to make bounds - (1 x 2) shape numpy array that limits the searchspace in the form of [[x1min,x1max],[x2min,x2max]] min_val - the smallest function value min_hyperparameters - hyperparameter pair corresponding to that value.
(Eg. run("rosenbrock",[1,10],300,np.array([[0,10],[-20,40]])))
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.
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.
One run with 500 iterations takes about 4 minutes if the function evaluation is instantaneous.
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
File details
Details for the file mihkelBayesian-1.0.0.tar.gz
.
File metadata
- Download URL: mihkelBayesian-1.0.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d8d858f15c64bd1962f90405f54f7d9c92e60b01ac4c547f758bfcb3c3666ec |
|
MD5 | 7245895136e739a50b190fe612a6c561 |
|
BLAKE2b-256 | 5d19acb43463ac8be3cf3ba79a19628b2d015ee083d60e9b8283f4d1f984ecc0 |
File details
Details for the file mihkelBayesian-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: mihkelBayesian-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1b27fbc11569a1da17374356d773e4baed04b737a717b71a140698a7a149f42 |
|
MD5 | 9b90d080bd6f548bb75ee301a2d911f8 |
|
BLAKE2b-256 | bb14fe9d9d07e22d82d7eac310959e6f9ef4cec423e13c445ae9cb7439d02287 |