Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update contribution documentation #329

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ 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/JaxGaussianProcesses/GPJax/blob/master/CONTRIBUTING.md).
contributing](https://github.com/JaxGaussianProcesses/GPJax/blob/main/docs/contributing.md).
If you have any questions, we encourage you to [open an
issue](https://github.com/JaxGaussianProcesses/GPJax/issues/new/choose). For
broader conversations, such as best GP fitting practices or questions about the
Expand Down Expand Up @@ -67,7 +67,7 @@ process modelling.
> - [**UCI regression**](https://docs.jaxgaussianprocesses.com/examples/yacht/)

## Conversion between `.ipynb` and `.py`
Above examples are stored in [examples](examples) directory in the double
Above examples are stored in [examples](docs/examples) directory in the double
percent (`py:percent`) format. Checkout [jupytext
using-cli](https://jupytext.readthedocs.io/en/latest/using-cli.html) for more
info.
Expand Down
28 changes: 19 additions & 9 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,17 @@ you through every detail!
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
development. Once the virtual environment is activated, run:
4. We use [Poetry](https://python-poetry.org/) for packaging and dependency management, and project requirements are in ``pyproject.toml``. We suggest using a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/) for
development. For those using Apple Silicon chips, we advise using [Conda miniforge](https://github.com/conda-forge/miniforge). Once the virtual environment is activated, run:

```bash
$ pip install -e .
$ pip install -r requirements-dev.txt
$ poetry install
```

At this point we recommend you check your installation passes the supplied unit tests:

```bash
$ poetry run pytest
```

5. Install the pre-commit hooks.
Expand All @@ -91,7 +95,13 @@ you through every detail!
successful, this will print the following output `pre-commit installed at
.git/hooks/pre-commit`.

1. Add changed files using `git add` and then `git commit` files to record your
6. At this point you can manually run the pre-commit hooks with the following command:

```bash
poetry run pre-commit run --all-files
```

7. Add changed files using `git add` and then `git commit` files to record your
changes locally:

```bash
Expand All @@ -112,7 +122,7 @@ you through every detail!
$ git push -u origin my-feature
```

7. Go to the GitHub web page of your fork of the GPJax repo. Click the 'Pull
8. 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.

Expand Down Expand Up @@ -143,13 +153,13 @@ request, we recommend you check the following:

- Do all public methods have informative docstrings that describe their
function, input(s) and output(s)?
- Do the pre-commit hooks pass?
- 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:

```bash
$ pip install -r requirements-dev.txt
$ pytest tests --cov=./ --cov-report=html
$ poetry run pytest tests --cov=./ --cov-report=html
```

Navigate to the newly created folder `htmlcov` and open `index.html` to view
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/intro_to_gps.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
)

# %% [markdown]
# Formmally, we can define this by letting $p(\mathbf{x}, \mathbf{y})$ be the
# Formally, we can define this by letting $p(\mathbf{x}, \mathbf{y})$ be the
# joint probability distribution defined over
# $\mathbf{x}\sim\mathcal{N}(\boldsymbol{\mu}_{\mathbf{x}}, \boldsymbol{\Sigma}_{\mathbf{xx}})$ and
# $\mathbf{y}\sim\mathcal{N}(\boldsymbol{\mu}_{\mathbf{y}}, \boldsymbol{\Sigma}_{\mathbf{yy}})$.
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/pytrees.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
such as `grad`.

We achieve this through providing a base `Module` abstraction to cleanly
handles parameter trainability and optimising transformations for JAX models.
handle parameter trainability and optimising transformations of JAX models.



Expand Down Expand Up @@ -106,7 +106,7 @@ compatible with JAX. To achieve this we must consider [JAX's _PyTree_](https://j
abstraction.


## PyTree’s
## PyTrees

JAX PyTrees are a powerful tool in the JAX library that enable users to work
with complex data structures in a way that is efficient, flexible, and easy to
Expand Down Expand Up @@ -177,7 +177,7 @@ structure and handle each leaf individually. JAX PyTrees, therefore, are a
powerful tool that can simplify many tasks in machine learning and scientific
computing. As such, most JAX functions operate over _PyTrees of JAX arrays_.
For instance, `jax.lax.scan`, accepts as input and produces as output a
PyTrees of JAX arrays.
PyTree of JAX arrays.

Another key advantages of using JAX PyTrees is that they are designed to work
efficiently with JAX's automatic differentiation and compilation features. For
Expand Down Expand Up @@ -231,7 +231,7 @@ For our RBF kernel we have two parameters; the lengthscale and the variance.
Both of these have positive domains, and by default we want to train both of
these parameters. To encode this we use a `param_field`, where we can define
the domain of both parameters via a `Softplus` bijector (that restricts them
to the positive domain), and define their trainble status to `True`.
to the positive domain), and set their trainable status to `True`.

```python
import tensorflow_probability.substrates.jax.bijectors as tfb
Expand Down