Skip to content

Commit

Permalink
Revise PR
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspinder committed Oct 19, 2022
1 parent 189939a commit e6f7f8a
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 86 deletions.
73 changes: 51 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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:<your GitHub handle>/GPJax.git
Expand All @@ -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
Expand All @@ -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:

Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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.

Expand All @@ -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.

Expand All @@ -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.

Expand All @@ -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
Expand All @@ -143,7 +143,7 @@ pip install gpjax
### Development version
## Development version
> **Warning**
>
> This version is possibly unstable and may contain bugs.
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit e6f7f8a

Please sign in to comment.