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 <http://dlib.net/python/index.html#dlib.find_max_global>_ for details.

A great blog post <http://blog.dlib.net/2017/12/a-global-optimization-algorithm-worth.html>_ 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.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lipo-1.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 17066e885137f3c6b293ce1a8ddf38e4126a7e8fe1119be0d9120042cac5b8c7
MD5 814b7aaa706ad061c9306e6303e76251
BLAKE2b-256 81930c89a45cb0a6bc7892c2f40b371af41f592acd2c504edb8ecc44503e019f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lipo-1.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8438db46cd33ff3f28d96e9db1d918718b7fdbddad88d6ad4e5086264aa04b3d
MD5 1c3bed1dbe9ae7fe68ece493c3fe4fd7
BLAKE2b-256 8585e07723b83d6f36dfbcd483dd620085b17852f4ba342ed6823b3efca84f5b

See more details on using hashes here.

Supported by

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