Giter Site home page Giter Site logo

aspuru-guzik-group / phoenics Goto Github PK

View Code? Open in Web Editor NEW
88.0 15.0 19.0 17.85 MB

Phoenics: Bayesian optimization for efficient experiment planning

License: Apache License 2.0

Python 100.00%
bayesian-optimization self-driving-laboratories experiment-planning phoenics

phoenics's Introduction

Phoenics

Phoenics is an open source optimization algorithm combining ideas from Bayesian optimization with Bayesian Kernel Density estimation [1]. It performs global optimization on expensive to evaluate objectives, such as physical experiments or demanding computations. Phoenics supports sequential and batch optimizations and allows for the simultaneous optimization of multiple objectives via the Chimera scalarizing function [2].

Check out the examples folder for detailed descriptions and code examples for:

Example Link
Sequential optimization examples/optimization_sequential
Parallelizable batch optimization examples/optimization_parallel
Periodic parameter support examples/optimization_periodic_parameters
Multi-objective optimization examples/optimization_multiple_objectives

More elaborate applications of Phoenics and Chimera are listed below

Application Link
Auto-calibration of a virtual robot examples/application_robot_calibration

Chimera

Chimera is a general purpose achievement scalarizing function for multi-objective optimization. User preferences regarding the objectives are expected in terms of an importance hierarchy, as well as relative tolerances on each objective indicating what level of degradation is acceptable. Chimera is integrated into Phoenics, but also available for download as a wrapper for other optimization methods (see chimera).

Installation

You can install Phoenics via pip

apt-get install python-pip
pip install phoenics

or by creating a conda environment from the provided environment file

conda env create -f environment.yml
source activate phoenics

Alternatively, you can also choose to build Phoenics from source by cloning this repository

git clone https://github.com/aspuru-guzik-group/phoenics.git
Requirements

This code has been tested with Python 3.6 and uses

  • cython 0.27.3
  • json 2.0.9
  • numpy 1.13.1
  • scipy 0.19.1

Phoenics can construct its probabilistic model with two different probabilistic modeling libraries: PyMC3 and Edward. Depending on your preferences, you will either need

  • pymc3 3.2
  • theano 1.0.1

or

  • edward 1.3.5
  • tensorflow 1.4.1

Check out the environment.yml file for more details.

Using Phoenics

Phoenics is designed to suggest new parameter points based on prior observations. The suggested parameters can then be passed on to objective evaluations (experiments or involved computation). As soon as the objective values have been determined for a set of parameters, these new observations can again be passed on to Phoenics to request new, more informative parameters.

from phoenics import Phoenics
    
# create an instance from a configuration file
config_file = 'config.json'
phoenics    = Phoenics(config_file)
    
# request new parameters from a set of observations
params      = phoenics.choose(observations = observations)

Detailed examples for specific applications are presented in the examples folder.

Using Chimera

Chimera is integrated into Phoenics, but also available as a stand-alone wrapper for other single-objective optimization algorithms. The Chimera wrapper allows to cast a set of objectives for a number of observations into a single objective value for each observation, enabling single-objective optimization algorithms to solve the multi-objective optimization problem. The usage of Chimera is outlined below on an example with four objective functions

from chimera import Chimera

# define tolerances in descending order of importance
tolerances = [0.25, 0.1, 0.25, 0.05]

# create Chimera instance
chimera = Chimera(tolerances)

# cast objectives of shape      [num_observations, num_objectives]
# into single objective vector  [num_observations, 1]
single_objectives = chimera.scalarize_objectives(objectives)

Note: Phoenics automatically employs Chimera when the configuration contains more than one objective.

Disclaimer

Note: This repository is under construction! We hope to add further details on the method, instructions and more examples in the near future.

Experiencing problems?

Please create a new issue and describe your problem in detail so we can fix it.

References

[1] Häse, F., Roch, L. M., Kreisbeck, C., & Aspuru-Guzik, A. Phoenics: A Bayesian Optimizer for Chemistry. ACS central science 4.6 (2018): 1134-1145.

[2] Häse, F., Roch, L. M., & Aspuru-Guzik, A. Chimera: enabling hierarchy based multi-objective optimization for self-driving laboratories. Chemical Science (2018).

phoenics's People

Contributors

florianhase avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phoenics's Issues

Installation fails: numpy/arrayobject.h not found

This happens on both ubuntu 18.04 and Windows 10, using both numpy 1.13.1 and 1.17.
In a Python 3.6.8 virtual environment, calling pip install phoenics fails with the following error:

phoenics/BayesianNeuralNetwork/dist evaluations.c:611:10 fatal error: numpy/arrayobject.h: no such file or directory.

On Win 10, the requested header file is in the folder
C:\Users\Larry\Documents\vscodeprojs\people.venv36\Lib\site-packages\numpy\core\include\numpy

Why is it not found by the include command?
Thanks for help, Larry

Can't excute examples

Describe the error
I want to execute examples in the folder. But when I execute the example, the error message came out like this(down message). Also, the same error message come out when I try to execute other examples in git.
What should I do to execute the example??
error

error message
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\phoenics\utilities\decorators.py", line 36, in wrapper
function(*args, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\phoenics\utilities\config_parser.py", line 368, in parse_config_file
self._parse(self.config_dict)
File "C:\ProgramData\Anaconda3\lib\site-packages\phoenics\utilities\config_parser.py", line 356, in _parse
self._parse_parameters(self.config['parameters'])

PhoenicsParseError: 'parameters'

Program setting
Jupyter Notebook

Command

  1. cd optimization_multiple_objectives/
  2. !python optimize_multi_objective.py

Installation errors with pip

Describe the bug
conda env create -f environment.yml does not work. I suspect that this is due to Anaconda removing support for any version <3.8. I tried the installation through pip. Here is the error I got.

Input:

pip install phoenics

Output:
Collecting phoenics
Using cached phoenics-0.2.0.tar.gz (177 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/private/var/folders/2z/b3nsqp4s48j2p8hgwhf1sj780000gp/T/pip-install-sezndou3/phoenics_6d2ab67fb8e44db9bcdf0f6d2eb4b991/setup.py", line 5, in
import numpy as np
ModuleNotFoundError: No module named 'numpy'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

To Reproduce
try to install using

pip install phoenics

Expected behavior
Installation of phoenics through pip

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MAcOS Monteray
  • This was tested on a fresh anaconda environment with python version 3.8 installed

Additional context
This was corrected by installing numpy prior to calling

pip install phoenics

PhoenicsParseError: 'parameters'

Hi,

I tried to execute an example of your repository, e.g. Sequential optimization. I run into the following error.

Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/site-packages/phoenics/utilities/decorators.py", line 36, in wrapper
    function(*args, **kwargs)
  File "/opt/conda/lib/python3.7/site-packages/phoenics/utilities/config_parser.py", line 368, in parse_config_file
    self._parse(self.config_dict)
  File "/opt/conda/lib/python3.7/site-packages/phoenics/utilities/config_parser.py", line 356, in _parse
    self._parse_parameters(self.config['parameters'])

PhoenicsParseError: 'parameters'

It looks like that the error has something to do with config.json.

Steps

  1. I used the image docker pull jupyter/datascience-notebook
  2. Cloned your repository.
  3. Navigated to phoenics/examples/optimization_sequential/
  4. python optimize_branin.py

Container Information

  • Ubuntu 18.04.4 LTS
  • Python 3.7.6
  • GCC 7.3.0

Thanks!

If you need additional information, let me know.

Best Regards
Bernhard

objective function

Hi Florian Hase,

I have read this paper. You have been mention many objective function in the Supplementary Information, such as Dejong, Camel, Branin. I could not find objective function in the code.
Could you tell me how can I find it. Many thanks!!

Best wishes

Can't install in Windows

Describe the bug
Unable to install via conda env create -f environment.yml or pip install phoenics.
Using yml file, none of the packages were found (error ResolvePackageNotFound).
Using pip, after having numpy and latest microsoft visual studio installed, an error came up building wheel for phoenics (setup.py) and clean install

To Reproduce
Steps to reproduce the behavior:
In Anaconda Prompt base environment, run conda env create -f environment.yml with yml-file downloaded.
Or, in an empty new environment, run pip install phoenics.

Expected behavior
Clean installation.

Desktop (please complete the following information):

  • OS: Windows10
  • conda : 4.6.11
  • python : 3.7.3.final.0

Additional context
Unsure if installation is okay in Windows.
Also unsure what the prerequisites are for installation.

Please advise.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.