From e6f7f8a8a1e34ccdc27535b113ec18aebed4e18c Mon Sep 17 00:00:00 2001 From: Thomas Pinder Date: Wed, 19 Oct 2022 21:30:33 +0000 Subject: [PATCH] Revise PR --- CONTRIBUTING.md | 73 ++++++++++++++++++++--------- README.md | 26 +++++------ docs/contributing.md | 108 ++++++++++++++++++++++++------------------- docs/installation.md | 6 +-- 4 files changed, 127 insertions(+), 86 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 647baf73e..0cfca247e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,35 +1,50 @@ # Guidelines for Contributing -GPJax welcomes contributions from interested individuals or groups. These guidelines help explain how you can contribute to the library +GPJax welcomes contributions from interested individuals or groups. These +guidelines help explain how you can contribute to the library -There are 4 main ways of contributing to the library (in descending order of difficulty or scope): +There are 4 main ways of contributing to the library (in descending order of +difficulty or scope): - Adding new or improved functionality to the existing codebase -- Fixing outstanding issues (bugs) with the existing codebase. They range from low-level software bugs to higher-level design problems. -- Contributing or improving the documentation (`docs`) or examples (`gpjax/docs/nbs`) +- Fixing outstanding issues (bugs) with the existing codebase. They range from + low-level software bugs to higher-level design problems. +- Contributing or improving the documentation (`docs`) or examples + (`gpjax/docs/nbs`) - Submitting issues related to bugs or desired enhancements ## Code of conduct -As a contributor to GPJax, you can help us keep the community open and inclusive. Please read and follow our [Code of Conduct](https://github.com/thomaspinder/GPJax/blob/master/.github/CODE_OF_CONDUCT.md). +As a contributor to GPJax, you can help us keep the community open and +inclusive. Please read and follow our [Code of +Conduct](https://github.com/thomaspinder/GPJax/blob/master/.github/CODE_OF_CONDUCT.md). # Opening issues and getting support -Please open issues on [Github Issue Tracker](https://github.com/thomaspinder/GPJax/issues/new/choose). +Please open issues on [Github Issue +Tracker](https://github.com/thomaspinder/GPJax/issues/new/choose). -You can ask a question or start a discussion in the [Discussion section](https://github.com/thomaspinder/GPJax/discussions) on Github. +You can ask a question or start a discussion in the [Discussion +section](https://github.com/thomaspinder/GPJax/discussions) on Github. # Contributing code via pull requests Please submit patches via pull requests. -The preferred workflow for contributing is to fork the [GitHub repository](https://github.com/thomaspinder/GPJax), clone it to your local machine, and develop on a feature branch. Once you are ready to commit your changes, install the pre-commit hooks with `pre-commit install` and the commit and push your code as usual. +The preferred workflow for contributing is to fork the [GitHub +repository](https://github.com/thomaspinder/GPJax), clone it to your local +machine, and develop on a feature branch. Once you are ready to commit your +changes, install the pre-commit hooks with `pre-commit install` and the commit +and push your code as usual. ## Steps: -1. Fork the [project repository](https://github.com/thomaspinder/GPJax) by clicking on the 'Fork' button near the top right of the main repository page. This creates a copy of the code under your GitHub user account. +1. Fork the [project repository](https://github.com/thomaspinder/GPJax) by + clicking on the 'Fork' button near the top right of the main repository page. + This creates a copy of the code under your GitHub user account. -2. Clone your fork of the GPJax repo from your GitHub account to your local disk, and add the base repository as a remote: +2. Clone your fork of the GPJax repo from your GitHub account to your local + disk, and add the base repository as a remote: ```bash $ git clone git@github.com:/GPJax.git @@ -43,32 +58,38 @@ The preferred workflow for contributing is to fork the [GitHub repository](https $ git checkout -b my-feature ``` - Always use a `feature` branch. It's good practice to never routinely work on the `master` branch of any repository. + Always use a `feature` branch. It's good practice to never routinely work on + the `master` branch of any repository. 4. Project requirements are in `requirements.txt`. - We suggest using a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/) for development. Once the virtual environment is activated, run: + We suggest using a [virtual + environment](https://docs.python-guide.org/dev/virtualenvs/) for development. + Once the virtual environment is activated, run: ```bash $ pip install -e . $ pip install -r requirements-dev.txt ``` -5. Install the pre-commit hooks. Please **ensure you do this before commiting any files**. This can be done by executing the following: +5. Install the pre-commit hooks. Please **ensure you do this before commiting + any files**. This can be done by executing the following: ```bash $ pre-commit install ``` - If successful, this will print the following output `pre-commit installed at .git/hooks/pre-commit`. + If successful, this will print the following output `pre-commit installed at + .git/hooks/pre-commit`. -6. Develop the feature on your feature branch. Add changed files using `git add` and then `git commit` files: +6. Develop the feature on your feature branch. Add changed files using `git add` + and then `git commit` files: ```bash $ git add modified_files $ git commit ``` - to record your changes locally. - After committing, it is a good idea to sync with the base repository in case there have been any changes: + to record your changes locally. After committing, it is a good idea to sync + with the base repository in case there have been any changes: ```bash $ git fetch upstream @@ -81,21 +102,29 @@ The preferred workflow for contributing is to fork the [GitHub repository](https $ git push -u origin my-feature ``` -7. Go to the GitHub web page of your fork of the GPJax repo. Click the 'Pull request' button to send your changes to the project's maintainer for review. +7. Go to the GitHub web page of your fork of the GPJax repo. Click the 'Pull + request' button to send your changes to the project's maintainer for review. ## Pull request checklist -We recommended that your contribution complies with the following guidelines before you submit a pull request: +We recommended that your contribution complies with the following guidelines +before you submit a pull request: -- If your pull request addresses an issue, please use the pull request title to describe the issue and mention the issue number in the pull request description. This will make sure a link back to the original issue is created. +- If your pull request addresses an issue, please use the pull request title to + describe the issue and mention the issue number in the pull request + description. This will make sure a link back to the original issue is created. - All public methods must have informative docstrings -- Please prefix the title of incomplete contributions with `[WIP]` (to indicate a work in progress). WIPs may be useful to (1) indicate you are working on something to avoid duplicated work, (2) request broad review of functionality or API, or (3) seek collaborators. +- Please prefix the title of incomplete contributions with `[WIP]` (to indicate + a work in progress). WIPs may be useful to (1) indicate you are working on + something to avoid duplicated work, (2) request broad review of functionality + or API, or (3) seek collaborators. - All other tests pass when everything is rebuilt from scratch. -- Documentation and high-coverage tests are necessary for enhancements to be accepted. +- Documentation and high-coverage tests are necessary for enhancements to be + accepted. - Code with good test, check with: diff --git a/README.md b/README.md index 3c217b4fe..98a81d807 100644 --- a/README.md +++ b/README.md @@ -17,20 +17,20 @@ | [**Documentation**](https://gpjax.readthedocs.io/en/latest/) | [**Slack Community**](https://join.slack.com/t/gpjax/shared_invite/zt-1da57pmjn-rdBCVg9kApirEEn2E5Q2Zw) -`GPJax` aims to provide a low-level interface to Gaussian process (GP) models in [`Jax`](https://github.com/google/jax), structured to give researchers maximum flexibility in extending the code to suit their own needs. The idea is that the code should be as close as possible to the maths we write on paper when working with GP models. +GPJax aims to provide a low-level interface to Gaussian process (GP) models in [Jax](https://github.com/google/jax), structured to give researchers maximum flexibility in extending the code to suit their own needs. The idea is that the code should be as close as possible to the maths we write on paper when working with GP models. # Package support -`GPJax`'s maintainers are [Thomas Pinder](https://github.com/thomaspinder) (founder) and [Daniel Dodd](https://github.com/Daniel-Dodd). +GPJax's was founded by [Thomas Pinder](https://github.com/thomaspinder). Today, the maintenance of GPJax is undertaken by [Thomas Pinder](https://github.com/thomaspinder) and [Daniel Dodd](https://github.com/Daniel-Dodd). We would be delighted to receive contributions from interested individuals and groups. To learn how you can get involved, please read our [guide for contributing](https://github.com/thomaspinder/GPJax/blob/master/CONTRIBUTING.md). If you have any questions, we encourage you to [open an issue](https://github.com/thomaspinder/GPJax/issues/new/choose). For broader conversations, such as best GP fitting practices or questions about the mathematics of GPs, we invite you to [open a discussion](https://github.com/thomaspinder/GPJax/discussions). -Feel free to join our [Slack Channel](https://join.slack.com/t/gpjax/shared_invite/zt-1da57pmjn-rdBCVg9kApirEEn2E5Q2Zw), where we can discuss the development of `GPJax` and broader support for Gaussian process modelling. +Feel free to join our [Slack Channel](https://join.slack.com/t/gpjax/shared_invite/zt-1da57pmjn-rdBCVg9kApirEEn2E5Q2Zw), where we can discuss the development of GPJax and broader support for Gaussian process modelling. # Supported methods and interfaces -### Notebook examples -> +## Notebook examples + > - [**Conjugate Inference**](https://gpjax.readthedocs.io/en/latest/examples/regression.html) > - [**Classification with MCMC**](https://gpjax.readthedocs.io/en/latest/examples/classification.html) > - [**Sparse Variational Inference**](https://gpjax.readthedocs.io/en/latest/examples/uncollapsed_vi.html) @@ -42,7 +42,7 @@ Feel free to join our [Slack Channel](https://join.slack.com/t/gpjax/shared_invi > - [**Learning Gaussian Process Barycentres**](https://gpjax.readthedocs.io/en/latest/examples/barycentres.html) > - [**Deep Kernel Regression**](https://gpjax.readthedocs.io/en/latest/examples/haiku.html) -### Guides for customisation +## Guides for customisation > > - [**Custom kernels**](https://gpjax.readthedocs.io/en/latest/examples/kernels.html#Custom-Kernel) @@ -69,7 +69,7 @@ D = gpx.Dataset(X=x, y=y) The function of interest here, $f(\cdot)$, is sinusoidal, but our observations of it have been perturbed by Gaussian noise. We aim to utilise a Gaussian process to try and recover this latent function. -### 1. Constructing the prior and posterior +## 1. Constructing the prior and posterior We begin by defining a zero-mean Gaussian process prior with a radial basis function kernel and assume the likelihood to be Gaussian. @@ -84,7 +84,7 @@ Similar to how we would write on paper, the posterior is constructed by the prod posterior = prior * likelihood ``` -### 2. Learning hyperparameters +## 2. Learning hyperparameters Equipped with the posterior, we seek to learn the model's hyperparameters through gradient-optimisation of the marginal log-likelihood. We this below, adding Jax's [just-in-time (JIT)](https://jax.readthedocs.io/en/latest/jax-101/02-jitting.html) compilation to accelerate training. @@ -109,7 +109,7 @@ Finally, we run an optimisation loop using the Adam optimiser via the `fit` call inference_state = gpx.fit(mll, parameter_state, opt, n_iters=500) ``` -### 3. Making predictions +## 3. Making predictions Using our learned hyperparameters, we can obtain the posterior distribution of the latent function at novel test points. @@ -126,9 +126,9 @@ predictive_cov = predictive_distribution.covariance_matrix # Installation -### Stable version +## Stable version -The latest stable version of `GPJax` can be installed via [`pip`](https://pip.pypa.io/en/stable/): +The latest stable version of GPJax can be installed via [`pip`](https://pip.pypa.io/en/stable/): ```bash pip install gpjax @@ -143,7 +143,7 @@ pip install gpjax -### Development version +## Development version > **Warning** > > This version is possibly unstable and may contain bugs. @@ -171,7 +171,7 @@ python setup.py develop # Citing GPJax -If you use `GPJax` in your research, please cite our [JOSS paper](https://joss.theoj.org/papers/10.21105/joss.04455#). +If you use GPJax in your research, please cite our [JOSS paper](https://joss.theoj.org/papers/10.21105/joss.04455#). ``` @article{Pinder2022, diff --git a/docs/contributing.md b/docs/contributing.md index e2e83979c..a401a6959 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -1,52 +1,64 @@ # How can I contribute? -`GPJax` welcomes contributions from interested individuals or groups. There are many ways to contibute, including: +GPJax welcomes contributions from interested individuals or groups. There are +many ways to contibute, including: -- Answering questions on our [dicussions page](https://github.com/thomaspinder/GPJax/discussions). -- Raising [issues](https://github.com/thomaspinder/GPJax/issues) related to bugs or desired enhancements. +- Answering questions on our [dicussions + page](https://github.com/thomaspinder/GPJax/discussions). +- Raising [issues](https://github.com/thomaspinder/GPJax/issues) related to bugs + or desired enhancements. - Contributing or improving the [docs](https://github.com/thomaspinder/GPJax/tree/master/docs) or [examples](https://github.com/thomaspinder/GPJax/tree/master/docs/nbs). -- Fixing outstanding [issues](https://github.com/thomaspinder/GPJax/issues) (bugs). +- Fixing outstanding [issues](https://github.com/thomaspinder/GPJax/issues) + (bugs). - Extending or improving our [codebase](https://github.com/thomaspinder/GPJax). +- Submitting issues related to bugs or desired enhancements. # Code of conduct -As a contributor to `GPJax`, you can help us keep the community open and +As a contributor to GPJax, you can help us keep the community open and inclusive. Please read and follow our [Code of Conduct](https://github.com/thomaspinder/GPJax/blob/master/.github/CODE_OF_CONDUCT.md). # Opening issues and getting support Please open issues on [Github Issue -Tracker](https://github.com/thomaspinder/GPJax/issues/new/choose). Here you can mention +Tracker](https://github.com/thomaspinder/GPJax/issues/new/choose). Here you can +mention You can ask a question or start a discussion in the [Discussion section](https://github.com/thomaspinder/GPJax/discussions) on Github. # Contributing to the source code -Submitting code contributions to `GPJax` is done via a [GitHub pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests). Our preferred workflow is to first fork the [GitHub -repository](https://github.com/thomaspinder/GPJax), clone it to your -local machine, and develop on a _feature branch_. Once you're happy with your changes, install our `pre-commit hooks`, `commit` and `push` your code. +Submitting code contributions to GPJax is done via a [GitHub pull +request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests). +Our preferred workflow is to first fork the [GitHub +repository](https://github.com/thomaspinder/GPJax), clone it to your local +machine, and develop on a _feature branch_. Once you're happy with your changes, +install our `pre-commit hooks`, `commit` and `push` your code. -**New to this?** Don't panic, our [guide](#step-by-step-guide) below will walk you through every detail! +**New to this?** Don't panic, our [guide](#step-by-step-guide) below will walk +you through every detail! -:::{attention} -Before opening a pull request we recommend you check our [pull request checklist](#pull-request-checklist). -::: +:::{attention} Before opening a pull request we recommend you check our [pull +request checklist](#pull-request-checklist). ::: ## Step-by-step guide: -1. Click [here](https://github.com/thomaspinder/GPJax/fork) to Fork `GPJax`'s codebase (alternatively, click the 'Fork' button towards the top right of the [main repository page](https://github.com/thomaspinder/GPJax)). This adds a copy of the codebase to your GitHub user account. +1. Click [here](https://github.com/thomaspinder/GPJax/fork) to Fork GPJax's + codebase (alternatively, click the 'Fork' button towards the top right of + the [main repository page](https://github.com/thomaspinder/GPJax)). This + adds a copy of the codebase to your GitHub user account. -2. Clone your `GPJax` fork from your GitHub account to your - local disk, and add the base repository as a remote: +2. Clone your GPJax fork from your GitHub account to your local disk, and add + the base repository as a remote: ```bash $ git clone git@github.com:/GPJax.git - $ cd `GPJax` + $ cd GPJax $ git remote add upstream git@github.com:GPJax.git ``` @@ -56,12 +68,11 @@ Before opening a pull request we recommend you check our [pull request checklist $ git checkout -b my-feature ``` - :::{attention} - Always use a `feature` branch. It's good practice to avoid work on the ``main`` branch of any repository. - ::: + :::{attention} Always use a `feature` branch. It's good practice to avoid + work on the ``main`` branch of any repository. ::: -4. Project requirements are in ``requirements.txt``. We suggest using a [virtual - environment](https://docs.python-guide.org/dev/virtualenvs/) for +4. Project requirements are in ``requirements.txt``. We suggest using a + [virtual environment](https://docs.python-guide.org/dev/virtualenvs/) for development. Once the virtual environment is activated, run: ```bash @@ -74,22 +85,19 @@ Before opening a pull request we recommend you check our [pull request checklist ```bash $ pre-commit install ``` - :::{warning} - Please ensure you have done this before - commiting any files. If successful, this will print the following output - `pre-commit installed at .git/hooks/pre-commit`. - ::: + :::{warning} Please ensure you have done this before commiting any files. If + successful, this will print the following output `pre-commit installed at + .git/hooks/pre-commit`. ::: -6. Add changed files using - `git add` and then `git commit` files to record your changes locally: +6. Add changed files using `git add` and then `git commit` files to record your + changes locally: ```bash $ git add modified_files $ git commit ``` - After committing, it is a good idea - to sync with the base repository in case there have been any - changes: + After committing, it is a good idea to sync with the base repository in case + there have been any changes: ```bash $ git fetch upstream @@ -102,44 +110,48 @@ Before opening a pull request we recommend you check our [pull request checklist $ git push -u origin my-feature ``` -7. Go to the GitHub web page of your fork of the `GPJax` repo. Click the - 'Pull request' button to send your changes to the project's - maintainers for review. +7. Go to the GitHub web page of your fork of the GPJax repo. Click the 'Pull + request' button to send your changes to the project's maintainers for + review. ## Pull request checklist -We welcome both complete or "work in progress" pull requests. Before opening one, we recommended you check the following -guidelines to ensure a smooth review process. +We welcome both complete or "work in progress" pull requests. Before opening +one, we recommended you check the following guidelines to ensure a smooth review +process. **My contribution is a "work in progress":** -Please prefix the title of incomplete contributions with `[WIP]` (to -indicate a work in progress). WIPs are useful to: +Please prefix the title of incomplete contributions with `[WIP]` (to indicate a +work in progress). WIPs are useful to: 1. Indicate you are working on something to avoid duplicated work. 2. Request broad review of functionality or API. 3. Seek collaborators. -In the description of the pull request, we recommend you outline where work needs doing. For example, do some tests need writing? +In the description of the pull request, we recommend you outline where work +needs doing. For example, do some tests need writing? **My contribution is complete:** -If addressing an issue, please use the pull request -title to describe the issue and mention the issue number in the pull -request description. This will make sure a link back to the original -issue is created. Then before making your pull request, we recommend you check the following: +If addressing an issue, please use the pull request title to describe the issue +and mention the issue number in the pull request description. This will make +sure a link back to the original issue is created. Then before making your pull +request, we recommend you check the following: - - Do all public methods have informative docstrings that describe their function, input(s) and output(s)? + - Do all public methods have informative docstrings that describe their + function, input(s) and output(s)? - Do the tests pass when everything is rebuilt from scratch? - - Documentation and high-coverage tests are necessary for enhancements - to be accepted. Test coverage can be checked with: + - Documentation and high-coverage tests are necessary for enhancements to be + accepted. Test coverage can be checked with: ```bash $ pip install -r requirements-dev.txt $ pytest tests --cov=./ --cov-report=html ``` - Navigate to the newly created folder `htmlcov` and open `index.html` to view the coverage report. + Navigate to the newly created folder `htmlcov` and open `index.html` to view + the coverage report. This guide was derived from [PyMC's guide to contributing](https://github.com/pymc-devs/pymc/blob/main/CONTRIBUTING.md). diff --git a/docs/installation.md b/docs/installation.md index ae2ef5dab..29875bcf1 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,6 +1,6 @@ # Installation -### Stable version +## Stable version The latest stable release of `GPJax` can be installed via `pip`: @@ -15,7 +15,7 @@ python -c 'import gpjax; print(gpjax.__version__)' ``` ::: -### GPU support +## GPU support GPU support is enabled through proper configuration of the underlying [Jax](https://github.com/google/jax) installation. CPU enabled forms of @@ -35,7 +35,7 @@ import jaxlib print(jaxlib.__version__) ``` -### Development version +## Development version :::{warning} This version is possibly unstable and may contain bugs.