项目作者: josejimenezluna

项目描述 :
Bayesian optimization for Python
高级语言: Python
项目地址: git://github.com/josejimenezluna/pyGPGO.git
创建时间: 2016-11-23T15:33:43Z
项目社区:https://github.com/josejimenezluna/pyGPGO

开源协议:MIT License

下载


pyGPGO: Bayesian Optimization for Python

Build Status
codecov
Documentation Status
DOI
status

sine

pyGPGO is a simple and modular Python (>3.5) package for bayesian optimization.

Bayesian optimization is a framework that can be used in situations where:

  • Your objective function may not have a closed form. (e.g. the result of a simulation)
  • No gradient information is available.
  • Function evaluations may be noisy.
  • Evaluations are expensive (time/cost-wise)

Installation

Retrieve the latest stable release from pyPI:

  1. pip install pyGPGO

Or if you’re feeling adventurous, retrieve it from this repo,

  1. pip install git+https://github.com/hawk31/pyGPGO

Check our documentation in http://pygpgo.readthedocs.io/.

Features

  • Different surrogate models: Gaussian Processes, Student-t Processes, Random Forests, Gradient Boosting Machines.
  • Type II Maximum-Likelihood of covariance function hyperparameters.
  • MCMC sampling for full-Bayesian inference of hyperparameters (via pyMC3).
  • Integrated acquisition functions

A small example!

The user only has to define a function to maximize and a dictionary specifying input space.

  1. import numpy as np
  2. from pyGPGO.covfunc import matern32
  3. from pyGPGO.acquisition import Acquisition
  4. from pyGPGO.surrogates.GaussianProcess import GaussianProcess
  5. from pyGPGO.GPGO import GPGO
  6. def f(x, y):
  7. # Franke's function (https://www.mathworks.com/help/curvefit/franke.html)
  8. one = 0.75 * np.exp(-(9 * x - 2) ** 2 / 4 - (9 * y - 2) ** 2 / 4)
  9. two = 0.75 * np.exp(-(9 * x + 1) ** 2/ 49 - (9 * y + 1) / 10)
  10. three = 0.5 * np.exp(-(9 * x - 7) ** 2 / 4 - (9 * y -3) ** 2 / 4)
  11. four = 0.25 * np.exp(-(9 * x - 4) ** 2 - (9 * y - 7) ** 2)
  12. return one + two + three - four
  13. cov = matern32()
  14. gp = GaussianProcess(cov)
  15. acq = Acquisition(mode='ExpectedImprovement')
  16. param = {'x': ('cont', [0, 1]),
  17. 'y': ('cont', [0, 1])}
  18. np.random.seed(1337)
  19. gpgo = GPGO(gp, acq, f, param)
  20. gpgo.run(max_iter=10)

Check the tutorials and examples folders for more ideas on how to use the software.

Citation

If you use pyGPGO in academic work please cite:

Jiménez, J., & Ginebra, J. (2017). pyGPGO: Bayesian Optimization for Python. The Journal of Open Source Software, 2, 431.