Skip to main content

Global, derivative-free optimization

Project description

LIPO is a package for derivative-free, global optimization. Is based on the dlib package and provides wrappers around its optimization routine.

The algorithm outperforms random search - sometimes by margins as large as 10000x. It is often preferable to Bayesian optimization which requires "tuning of the tuner". Performance is on par with moderately to well tuned Bayesian optimization.

The provided implementation has the option to automatically enlarge the search space if bounds are found to be too restrictive (i.e. the optimum being to close to one of them).

See the LIPO algorithm implementation for details.

A great blog post by the author of dlib exists, describing how it works.

Installation

Execute

pip install lipo

Usage

from lipo import GlobalOptimizer

def function(x, y, z):
    zdict = {"a": 1, "b": 2}
    return -((x - 1.23) ** 6) + -((y - 0.3) ** 4) * zdict[z]

pre_eval_x = dict(x=2.3, y=13, z="b")
evaluations = [(pre_eval_x, function(**pre_eval_x))]

search = GlobalOptimizer(
    function,
    lower_bounds={"x": -10.0, "y": -10},
    upper_bounds={"x": 10.0, "y": -3},
    categories={"z": ["a", "b"]},
    evaluations=evaluations,
    maximize=True,
)

num_function_calls = 1000
search.run(num_function_calls)

The optimizer will automatically extend the search bounds if necessary.

Further, the package provides an implementation of the scikit-learn interface for hyperparamter search.

from lipo import LIPOSearchCV

search = LIPOSearchCV(
    estimator,
    param_space={"param_1": [0.1, 100], "param_2": ["category_1", "category_2"]},
    n_iter=100
)
search.fit(X, y)
print(search.best_params_)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lipo-1.2.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

lipo-1.2.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file lipo-1.2.1.tar.gz.

File metadata

  • Download URL: lipo-1.2.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.7 Darwin/19.4.0

File hashes

Hashes for lipo-1.2.1.tar.gz
Algorithm Hash digest
SHA256 981706fb20c21c617341996e2e57dec4a369d57aab5bd716431195a6e9b15ebe
MD5 86c58138342fe30344b4c4ea273d825c
BLAKE2b-256 1efef0cd2d5df72efa1b79037fe3164ebe266dd8a6da7ddd8c44b34e744937e4

See more details on using hashes here.

Provenance

File details

Details for the file lipo-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: lipo-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.7 Darwin/19.4.0

File hashes

Hashes for lipo-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1910bab56b99ba563afc3662dc01eccf05728b7939a58f669dcd975487d1b794
MD5 56daaafa6d490ca6f932a34bf2285a11
BLAKE2b-256 bc8571ff4db114666a779472b8db411666df35f524098bb3e43d714eab50987c

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page