Skip to main content

gfsopt

Documentation Status Latest Version

pip3 install --user gfsopt

Convenient scaffolding for the excellent Global Function Search hyperparameter optimizer from the Dlib library. (See: 'A Global Optimization Algorithm Worth Using')

Provides the following features:

  • Parallel optimization: Run multiple hyperparameter searches in parallel
  • Save and restore progress: Save/restore settings and optimization progress to/from file.
  • Average over multiple runs: Run a stochastic objective function using the same parameters multiple times and report the average to Dlib's Global Function Search. Useful in highly stochastic domains to avoid biasing the search towards lucky runs.

Example usage

A basic example where we maximize obj_func with respect to y over 10 runs, with as many parallel processes as there are logical cores, and save progress to file.

from gfsopt import GFSOptimizer
def obj_func(x, y, pid):
    """"Function to be maximized (pid is iteration number)""""
    a = (1.5 - x + x * y)**2
    b = (2.25 - x + x * y * y)**2
    c = (2.625 - x + x * y * y * y)**2
    return -(a + b + c)
# For this example we pretend that we want to keep 'x' fixed at 0.5
# while optimizing 'y' in the range -4.5 to 4.5
pp = {'x': 0.5}  # Problem parameters
space = {'y': [-4.5, 4.5]}  # Parameters to optimize over
optimizer = GFSOptimizer(pp, space, fname="test.pkl")
# Will sample and test 'y' 10 times, then save results, progress and settings to file
optimizer.run(obj_func, n_sims=10)

For a more extensive example, see example.py.

Installation & Requirements

Requires Python >=3.6 and the following libraries:

datadiff
dlib
numpy

To install, do:

pip3 install --user gfsopt

Documentation

See example.py for an example and http://gfsopt.readthedocs.io/ for API documentation.

Metadata

Release files for gfsopt 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gfsopt 1.1.0
File Size Uploaded
gfsopt-1.1.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gfsopt 1.1.0
File Interpreter ABI Platform
gfsopt-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.4 kB

Release files / gfsopt-1.1.0.tar.gz

Download URL gfsopt-1.1.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
938e77d6b9abf730ede62ebc99559fb13f5080c5700f48a0451809d1f83eee43
BLAKE2b-256 checksum
How to use checksums
03fefc6f0d1d0a20bc35bdbbc0375b1de6c11c67f90e5d0c37fea4d34240e860
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

Release files / gfsopt-1.1.0-py3-none-any.whl

Download URL gfsopt-1.1.0-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7db053cd485de8d31448477c9b3352a243271aefa4e4a3394a8f39be97055ad4
BLAKE2b-256 checksum
How to use checksums
19e1eaef8f66dc93600a6319a0c72cb21baa2687b99b840a42b77496216451de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.0

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page