Utilities to streamline GPyOpt interfaces for ML
## How to use
GPyOpt is incredibly powerful, but a tad clunky. This lightweight package
provides two utilities in ``pydrobert.gpyopt`` to make things easier. The
first, ``GPyOptObjectiveWrapper``, wraps a function for use in GPyOpt. The
second, ``bayesopt``, takes a wrapper instance and a
``BayesianOptimizationParams`` instance and handles the optimization loop.
Here's an example:
``` python
def foo(a, d, b, **kwargs):
r = a ** d + b
weirdness = kwargs['weirdness']
if weirdness == 'flip':
r *= -1
elif weirdness == 'null':
r = 0
return r
wrapped = GPyOptObjectiveWrapper(foo)
wrapped.set_fixed_parameter('b', 1.) # 'b' will always be 1
wrapped.set_variable_parameter('a', 'continuous', (-1., 1.)) # a is real
# btw [-1,1] inc
wrapped.set_variable_parameter('d', 'discrete', (0, 3)) # d is an int
# btw [0, 3] inc
wrapped.add_parameter('weirdness') # we can add new parameters as dynamic
# keyword args if the method has a **
# parameter
wrapped.set_variable_parameter( # weirness one of the elements in the list
'weirdness', 'categorical', ('flip', 'null', None))
params = BayesianOptimizationParams(
seed=1, # setting this makes the bayesian optimization deterministic
# (assuming foo is deterministic)
log_after_iters=5,
)
best = bayesopt(wrapper, params, 'hist.csv')
```
If you provide a history file to read/write from, optimization can be
resumed after unexpected interrupts. There are a lot of options to ``bayesopt``
that are listed in ``BayesianOptimizationParams``.
## Installation
GPyOpt currently does not have a Conda build, so pydrobert-gpyopt is available
via PyPI and source install.
``` bash
pip install pydrobert-gpyopt
```
Metadata
Release files for pydrobert-gpyopt 0.0.0
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 |
|---|---|---|---|---|
| pydrobert-gpyopt-0.0.0.tar.gz | 11.2 kB | Without provenance | Details for pydrobert-gpyopt-0.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydrobert_gpyopt-0.0.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pydrobert_gpyopt-0.0.0-py2.py3-none-any.whl |
Total release size: 22.9 kB
Release files / pydrobert-gpyopt-0.0.0.tar.gz
| Download URL | pydrobert-gpyopt-0.0.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2012c12f80741eee662d201ec0f47dd6f281807b55ec1903ae500cb51aca8af0
|
|
BLAKE2b-256 checksum How to use checksums |
4720c190127769edcbdf804935aefcb7417c66ebabef8d7849dd48a63fb1581d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Release files / pydrobert_gpyopt-0.0.0-py2.py3-none-any.whl
| Download URL | pydrobert_gpyopt-0.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e90221dce40f9f0cb2b525dd8206e4e8eb00905d9dc1fdbdf5b7f280f7b79e21
|
|
BLAKE2b-256 checksum How to use checksums |
a1f7ff70146ee99ab20c901058d4cc50240bfec2800c595247c9605235f08b7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
|
Security for pydrobert-gpyopt 0.0.0
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.