From d2f6be939ccdbfd6654c45d66f6b136c37392cc4 Mon Sep 17 00:00:00 2001 From: ST John Date: Wed, 27 May 2020 17:55:43 +0100 Subject: [PATCH 1/3] bring contributing.md up to date --- contributing.md | 55 +++++++++++-------------------------------------- 1 file changed, 12 insertions(+), 43 deletions(-) diff --git a/contributing.md b/contributing.md index 63e58c9cf..37227d83c 100644 --- a/contributing.md +++ b/contributing.md @@ -15,9 +15,9 @@ This file contains notes for potential contributors to GPflow, as well as some n ## Project scope -With GPflow, we aim to make an extensible library for Gaussian processes which makes building complex models easy. In order to do this, we aim to make GPflow a complete library for doing inference and prediction in sophisticated ways (focussing mainly on variational inference) for *single layer models* only. In order to allow more complicated models to be implemented, we also provide functionality for latent / uncertain inputs. Other models, like deep GPs, can be implemented in their own repository by using GPflow as a dependency. We choose to limit the scope deliberately in order to ensure a high quality codebase. +With GPflow, we aim to make an extensible library for Gaussian processes which makes building complex models easy. In order to do this, we aim to make GPflow a complete library for doing inference and prediction in sophisticated ways (focussing mainly on variational inference) for *single layer models* only. In order to allow more complicated models to be implemented, we also provide functionality for latent / uncertain inputs. Other models, like deep GPs, can be implemented in their own repository by using GPflow as a dependency. We choose to limit the scope deliberately in order to ensure a high-quality codebase. -We welcome contributions to GPflow. If you would like to contribute a feature, please raise discussion via a GitHub issue, to discuss the suitability of the feature within GPflow. If the feature is outside the envisaged scope, we can still link to a separate project in our Readme. Large features also make it onto the [roadmap](roadmap.md). +We welcome contributions to GPflow. If you would like to contribute a feature, please raise discussion via a GitHub issue, to discuss the suitability of the feature within GPflow. If the feature is outside the envisaged scope, we can still link to a separate project in our Readme. ### I have this big feature/extension I would like to add... @@ -25,7 +25,7 @@ Due to limited scope we may not be able to review and merge every feature, howev ### ...but it won't work without changes to GPflow core? -We aim to have the GPflow core infrastructure be sufficiently extensible and modular to enable a wide range of third-party extensions without having to touch the core of GPflow. The `inducing_variables` module is an example of this to enable interdomain approximations (multiscale inducing features, Fourier features, etc.). If your feature/extension does not work outside of GPflow-core because something is hard-coded, please open an issue to discuss this with us! +We aim to have the GPflow core infrastructure be sufficiently extensible and modular to enable a wide range of third-party extensions without having to touch the core of GPflow. The `inducing_variables` module is an example of this to enable interdomain approximations (multiscale inducing features, Fourier features, etc.). If your feature/extension does not work outside of GPflow-core because something is hard-coded, please open an issue to discuss this with us! We are happy to discuss and implement changes to the core code that make it easier for you to extend GPflow with a separate package. ## Code quality requirements @@ -36,62 +36,35 @@ If the code which you are working on does not yet have any documentation, we wou - Python code should generally follow the *PEP8* style. We use some custom naming conventions (see below) to have our notation follow the Gaussian process literature. Use `pylint` and `mypy` for formatting and _type checking_. GPflow project has a `.pylintrc` with some relaxed naming conventions. - Practise writing good code as far as is reasonable. Simpler is usually better. Reading the existing GPflow code should give a good idea of the expected style. -Example: - -```python -class Foo: - """This is an example class with a single simple static method. - It mimics a singleton class which can run TensorFlow tensors.""" - - @classmethod - def add_one(cls, tensor: tf.Tensor, op_name: Optional[str] = None) -> Union[int, float, np.ndarray]: - """Increment input tensor and run it in default GPflow session. - It is assumed that you have already instantiated variables in - the default GPflow session before calling this method. - - :param tf.Tensor tensor: Input tensor. - :param str op_name: Name scope for TensorFlow operation. - - :return: Result depends on which value was passed to - the method. It can be either a scalar or NumPy array. - """ - default_name = self.__class__.__name__ - name = op_name if op_name is not None else default_name - session = gpflow.get_default_session() - with tf.name_scope(name): - incr_tensor = tensor + 1 - return session.run(incr_tensor) -``` - ### Naming conventions Variable names: scalars and vectors start lowercase, but following the notation used in Gaussian process papers, all matrices are denoted with upper case. For example, `lengthscales` denotes a vector (i.e., rank 1, for example a tensor with shape [D]), whereas `Xnew` denotes a matrix (i.e., rank 2, for example a tensor with shape [N, D]; note that a [N, 1] tensor is a matrix, not a vector). ### Formatting -GPflow uses [black](https://github.com/psf/black) for formatting in the following way: +GPflow uses [black](https://github.com/psf/black) for formatting, calling it with `black -t py36 -l 100`. Simply run `make format` from the GPflow root directory. -```bash -black -t py36 -l 100 gpflow tests doc setup.py -``` +## Pull requests -## Pull requests and the master branch +If you think that your contribution falls within the project scope (see above) please submit a Pull Request (PR) to our GitHub page. +(GitHub provides extensive documentation on [forking](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) and [pull requests](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests).) -If you think that your contribution falls within the project scope (see above) please submit a Pull Request (PR) to our GitHub page. In order to maintain code quality, and make life easy for the reviewers, please ensure that your PR: +In order to maintain code quality, and make life easy for the reviewers, please ensure that your PR: - Only fixes one issue or adds one feature. - Makes the minimal amount of changes to the existing codebase. +- Is testing its changes. +- Passes all checks (formatting, types, tests - you can run them all locally using `make check-all` from the GPflow root directory). All code goes through a PR; there are no direct commits to the master and develop branches. - ## Tests and continuous integration GPflow is ~97% 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 CircleCI and coverage is reported by codecov. Pull requests should aim to have >97% *patch* coverage (i.e., all the lines that are *changing* should be covered by tests). ## Documentation -GPflow's documentation is not comprehensive, but covers enough to get users started. We expect that new features have documentation that can help others get up to speed. The docs are mostly IPython notebooks that compile into HTML via Sphinx, using nbsphinx. +GPflow's documentation is not comprehensive, but covers enough to get users started. We expect that new features have documentation that can help others get up to speed. The docs are mostly IPython notebooks (stored in the git repository in jupytext format) that compile into HTML via Sphinx, using nbsphinx. ## Version numbering @@ -99,11 +72,7 @@ The main purpose of versioning GPflow is user convenience. We use the [semantic versioning scheme](https://semver.org/). The semver implies `MAJOR.MINOR.PATCH` version scheme, where `MAJOR` changes when there are incompatibilities in API, `MINOR` means adding functionality without breaking existing API and `PATCH` presumes the code update has backward compatible bug fixes. -When incrementing the version number, the following tasks are required: - -- Update the version in `./VERSION` -- Update the version in `./doc/source/conf.py` -- Add a note to `RELEASE.md` +When incrementing the version number, this has to be reflected both in `./VERSION` and in `./doc/source/conf.py`. ### Keeping up with TensorFlow From 2720091e1286b7078adfc0876b87b39e0cbf4d7f Mon Sep 17 00:00:00 2001 From: st-- Date: Thu, 28 May 2020 10:16:45 +0100 Subject: [PATCH 2/3] Update contributing.md Co-authored-by: joelberkeley-pio --- contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing.md b/contributing.md index 37227d83c..c9e4f4cb1 100644 --- a/contributing.md +++ b/contributing.md @@ -64,7 +64,7 @@ GPflow is ~97% covered by the testing suite. We expect changes to code to pass t ## Documentation -GPflow's documentation is not comprehensive, but covers enough to get users started. We expect that new features have documentation that can help others get up to speed. The docs are mostly IPython notebooks (stored in the git repository in jupytext format) that compile into HTML via Sphinx, using nbsphinx. +GPflow's documentation is not comprehensive, but covers enough to get users started. We expect that new features have documentation that can help others get up to speed. The docs are mostly IPython notebooks (stored in the git repository in Jupytext format) that compile into HTML via Sphinx, using nbsphinx. ## Version numbering From 8483fcc33b92dc47d735b3ae162bddb0bc487aee Mon Sep 17 00:00:00 2001 From: ST John Date: Thu, 28 May 2020 12:33:50 +0100 Subject: [PATCH 3/3] remove commented-out sentence on roadmap.md altogether --- contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing.md b/contributing.md index c9e4f4cb1..bec486e15 100644 --- a/contributing.md +++ b/contributing.md @@ -17,7 +17,7 @@ This file contains notes for potential contributors to GPflow, as well as some n With GPflow, we aim to make an extensible library for Gaussian processes which makes building complex models easy. In order to do this, we aim to make GPflow a complete library for doing inference and prediction in sophisticated ways (focussing mainly on variational inference) for *single layer models* only. In order to allow more complicated models to be implemented, we also provide functionality for latent / uncertain inputs. Other models, like deep GPs, can be implemented in their own repository by using GPflow as a dependency. We choose to limit the scope deliberately in order to ensure a high-quality codebase. -We welcome contributions to GPflow. If you would like to contribute a feature, please raise discussion via a GitHub issue, to discuss the suitability of the feature within GPflow. If the feature is outside the envisaged scope, we can still link to a separate project in our Readme. +We welcome contributions to GPflow. If you would like to contribute a feature, please raise discussion via a GitHub issue, to discuss the suitability of the feature within GPflow. If the feature is outside the envisaged scope, we can still link to a separate project in our Readme. ### I have this big feature/extension I would like to add...