Skip to content

Commit e09c78c

Browse files
icouckuyjavdrher
authored andcommitted
Another documentation pass (#63)
* Updated the introduction of the documentation * Added contributing and release files * Updated introduction and fixed typos in some notebooks * Added TF to install_requires if not installed. Adjusted install guide and fixed typos in contributing.md * Added log1pe transforms to keep ell > 1e-3 for stability to firststeps notebook too * Updated contributing * Fixed minor typo
1 parent 811ea4c commit e09c78c

6 files changed

Lines changed: 116 additions & 37 deletions

File tree

CONTRIBUTING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Contributing to GPflowOpt
2+
This file contains notes for potential contributors to GPflowOpt, as well as some notes that may be helpful for maintenance. As part of the GPflow organisation, GPflowOpt follows the same philosophy and principles with regards to scope and code quality as GPflow.
3+
4+
## Project scope
5+
We do welcome contributions to GPflowOpt. However, the project is deliberately of limited scope, to try to ensure a high quality codebase: if you'd like to contribute a feature, please raise discussion via a GitHub issue.
6+
7+
Due to limited scope we may not be able to review and merge every feature, however useful it may be. Particularly large contributions or changes to core code are harder to justify against the scope of the project or future development plans. For these contributions, we suggest you publish them as a separate package based on GPflowOpt's interfaces. We can link to your project from an issue discussing the topic or within the repository. Discussing a possible contribution in an issue should give an indication to how broadly it is supported to bring it into the codebase.
8+
9+
## Code Style
10+
- Python code should follow roughly the [PEP 8](https://www.python.org/dev/peps/pep-0008/) style. We allow exceptions for, e.g., capital (single-letter) variable names to correspond to the notation of a paper (matrices, vectors, etc.). To help with this, we suggest using a plugin for your editor (we use pycharm).
11+
- Practise good code as far as is reasonable. Simpler is usually better. Avoid using complicated language features. Reading the existing GPflowOpt code should give a good idea of the expected style.
12+
13+
## Pull requests and the master branch
14+
All code that is destined for the master branch of GPflowOpt goes through a PR and will be reviewed. Only a small number of people can merge PRs onto the master branch (currently Joachim van der Herten and Ivo Couckuyt).
15+
16+
## Tests and continuous integration
17+
GPflowOpt is 99% covered by the testing suite. We expect changes to code to pass these tests, and for new code to be covered by new tests. Currently, tests are run by travis (python 2.7, 3.5 and 3.6), coverage is reported by codecov.
18+
19+
By default, all tests are run on Travis except for the most expensive notebooks.
20+
21+
## Documentation
22+
GPflowOpt's documentation is not comprehensive, but covers enough to get users started. We expect that new features have documentation that can help other get up to speed. The docs are mostly Jupyter notebooks that compile into html via sphinx, using nbsphinx.
23+
24+
## Keeping up with GPflow and TensorFlow
25+
26+
GPflowOpt currently tries to keep up with the GPflow master, though at some point we will start depending on the latest released version. Hence, GPflowOpt also adheres to the api of the TensorFlow version as required by GPflow. In practice this hopefully means we will support the latest (stable) TensorFlow, which is supported by GPflow. Any change in the supported version of GPflow or TensorFlow will bump the minor version number of GPflowOpt.
27+
28+
Changing the minimum required version of TensorFlow that we're compatible with requires a few tasks:
29+
- update versions in `setup.py`
30+
- update versions used on travis via `.travis.yml`
31+
- update version ussed by readthedocs.org via `docsrequire.txt`
32+
- Increment the GPflowOpt version (see below).
33+
34+
## Version numbering
35+
The main purpose of versioning GPflowOpt is user convenience: to keep the number of releases down, we try to combine seversal PRs into one increment. As we work towards something that we might call 1.0, including changes to the GPflowOpt API. Minor version bumps (X.1) are used for updates to follow a new GPflow or TensorFlow API, or introduce incremental new features.
36+
When incrementing the version number, the following tasks are required:
37+
- Update the version in `GPflowOpt/_version.py`
38+
- Add a note to `RELEASE.md`

RELEASE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Pre-release

doc/source/intro.rst

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,39 @@
22
Introduction
33
------------
44

5-
GPflowOpt is a library for Bayesian Optimization with GPflow. It makes use of TensorFlow for computation of acquisition functions,
6-
to offer scalability, and avoid implementation of gradients. The package was created, and is currently maintained
7-
by `Joachim van der Herten <http://sumo.intec.ugent.be/jvanderherten>`_ and `Ivo Couckuyt <http://sumo.intec.ugent.be/icouckuy>`_
5+
`GPflowOpt <https://github.com/GPflow/GPflowOpt/>`_ is a library for Bayesian Optimization with `GPflow <https://github.com/GPflow/GPflow/>`_.
6+
It makes use of TensorFlow for computation of acquisition functions, to offer scalability, and avoid implementation of gradients.
7+
The package was created, and is currently maintained by `Joachim van der Herten <http://sumo.intec.ugent.be/jvanderherten>`_ and `Ivo Couckuyt <http://sumo.intec.ugent.be/icouckuy>`_
88

99
Currently the software is pre-release and under construction, hence it lacks a lot of functionality and testing. This documentation
1010
is also incomplete and under development. The project is open source: if you feel you have some relevant skills and are interested in
1111
contributing then please contact us on `GitHub <https://github.com/GPflow/GPflowOpt>`_ by opening an issue or pull request.
1212

1313
Install
1414
--------
15-
1. Install TensorFlow
15+
1. Install package
1616

17-
You will need version 1.0 or above. We find that for many users pip installation is the fastest way to get going.
18-
``pip install tensorflow``
17+
A straightforward way to install GPflowOpt is to clone its repository and run
1918

20-
For alternative installations, please see the instructions on the main `TensorFlow webpage <https://www.tensorflow.org/install/>`_.
19+
``pip install . --process-dependency-links``
2120

22-
2. Install package
21+
in the root folder. This also installs required dependencies including TensorFlow.
22+
For alternative TensorFlow installations (e.g., gpu), please see the instructions on the main `TensorFlow webpage <https://www.tensorflow.org/install/>`_.
2323

24-
GPflowOpt is a pure python library for now, so you could just add it to your path (we use ``python setup.py develop``). A straightforward way to install GPflowOpt including all of its dependencies: ``pip install . --process-dependency-links``
25-
A different way to install the package: ``python setup.py install`` (untested)
24+
2. Development
2625

27-
You can run the tests with ``python setup.py test``.
26+
GPflowOpt is a pure python library so you could just add it to your python path. We use
2827

29-
To build the documentation, first install extra dependencies with ``pip install .[docs]``, then proceed with ``python setup.py build_sphinx``.
28+
``pip install -e . --process-dependency-links``
29+
30+
3. Testing and documentation
31+
32+
The tests require some additional dependencies that need to be installed first with
33+
``pip install -e .[test]``. Afterwards the tests can be run with ``python setup.py test``.
34+
35+
Similarly, to build the documentation,
36+
first install the extra dependencies with ``pip install -e .[docs]``.
37+
Then proceed with ``python setup.py build_sphinx``.
3038

3139
Getting started
3240
---------------
@@ -39,4 +47,4 @@ For more advanced use cases have a look at the other :ref:`tutorial <tutorials>`
3947
Acknowledgements
4048
-----------------
4149
Joachim van der Herten and Ivo Couckuyt are Ghent University - imec postdoctoral fellows. Ivo Couckuyt is supported
42-
by FWO Vlaanderen.
50+
by FWO Vlaanderen.

doc/source/notebooks/firststeps.ipynb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
"source": [
1717
"## Introduction\n",
1818
"\n",
19-
"Bayesian optimization is particularly useful for expensive optimization problems. This includes optimization problems where the objective (and constraints) are time-consuming to evaluate: measurements, engineering simulations, cross-hyperparameter optimization of deep learning models, etc. Another area where Bayesian optimization may provide a benefit is in the presence of (a lot of) noise.\n",
19+
"Bayesian optimization is particularly useful for expensive optimization problems. This includes optimization problems where the objective (and constraints) are time-consuming to evaluate: measurements, engineering simulations, hyperparameter optimization of deep learning models, etc. Another area where Bayesian optimization may provide a benefit is in the presence of (a lot of) noise. If your problem does not satisfy these requirements other optimization algorithms might be better suited.\n",
2020
"\n",
21-
"If your problem does not satisfy these requirements other optimization algorithms might be better suited.\n",
22-
"\n",
23-
"To setup a basic Bayesian optimization you have to:\n",
21+
"To setup a Bayesian optimization scheme with GPflowOpt you have to:\n",
2422
"\n",
2523
"- define your objective and specify the optimization domain\n",
2624
"- setup a GPflow model and choose an acquisition function\n",
@@ -45,7 +43,7 @@
4543
"<table id='domain' width=100%><tr><td>Name</td><td>Type</td><td>Values</td></tr><tr><td>x1</td><td>Continuous</td><td>[-2. 2.]</td></tr><tr><td>x2</td><td>Continuous</td><td>[-1. 2.]</td></tr></table>"
4644
],
4745
"text/plain": [
48-
"<GPflowOpt.domain.Domain at 0x21ea69589b0>"
46+
"<GPflowOpt.domain.Domain at 0x7f1f613eef60>"
4947
]
5048
},
5149
"execution_count": 1,
@@ -60,7 +58,6 @@
6058
"\n",
6159
"def fx(X):\n",
6260
" X = np.atleast_2d(X)\n",
63-
" # Return objective & gradient\n",
6461
" return np.sum(np.square(X), axis=1)[:, None]\n",
6562
"\n",
6663
"domain = ContinuousParameter('x1', -2, 2) + ContinuousParameter('x2', -1, 2)\n",
@@ -83,12 +80,15 @@
8380
"name": "stdout",
8481
"output_type": "stream",
8582
"text": [
86-
"Warning: optimization restart 5/5 failed\n",
87-
" fun: array([ 1.69219493e-05])\n",
83+
"Warning: optimization restart 1/5 failed\n",
84+
"Warning: optimization restart 2/5 failed\n",
85+
"Warning: optimization restart 3/5 failed\n",
86+
"Warning: optimization restart 2/5 failed\n",
87+
" fun: array([ 0.01])\n",
8888
" message: 'OK'\n",
8989
" nfev: 15\n",
9090
" success: True\n",
91-
" x: array([[ -9.60370839e-05, 4.11250850e-03]])\n"
91+
" x: array([[ 0. , -0.1]])\n"
9292
]
9393
}
9494
],
@@ -104,6 +104,7 @@
104104
"X = lhd.generate()\n",
105105
"Y = fx(X)\n",
106106
"model = GPflow.gpr.GPR(X, Y, GPflow.kernels.Matern52(2, ARD=True))\n",
107+
"model.kern.lengthscales.transform = GPflow.transforms.Log1pe(1e-3)\n",
107108
"\n",
108109
"# Now create the Bayesian Optimizer\n",
109110
"alpha = ExpectedImprovement(model)\n",
@@ -119,7 +120,7 @@
119120
"cell_type": "markdown",
120121
"metadata": {},
121122
"source": [
122-
"That's all! Your objective function has now been optimized over 15 iterations."
123+
"That's all! Your objective function has now been optimized for 15 iterations."
123124
]
124125
}
125126
],

0 commit comments

Comments
 (0)