### Install GPJax Stable (pip) Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/installation.md Installs the latest stable release of GPJax using pip. ```bash pip install gpjax ``` -------------------------------- ### Install GPJax Development Version Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/installation.md Installs the latest development version of GPJax by cloning the repository and using uv. ```bash git clone https://github.com/thomaspinder/GPJax.git cd GPJax uv sync --extra dev ``` -------------------------------- ### Install GPJax Stable (conda) Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/installation.md Installs the latest stable release of GPJax using conda. ```bash conda install --channel conda-forge gpjax ``` -------------------------------- ### Run GPJax All Tests Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/installation.md Executes all unit tests for GPJax using uv run poe. ```bash uv run poe all-tests ``` -------------------------------- ### Install GPJax Stable (conda-forge/Pixi) Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/installation.md Installs the latest stable release of GPJax using conda-forge with Pixi. ```bash pixi add gpjax ``` -------------------------------- ### Create GPJax Virtual Environment Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/installation.md Creates a conda virtual environment named 'gpjax_experimental' with Python 3.10.0. ```bash conda create -n gpjax_experimental python=3.10.0 conda activate gpjax_experimental ``` -------------------------------- ### Check GPJax Installation Version Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/installation.md Verifies the installed version of GPJax by running a Python command. ```python python -c 'import gpjax; print(gpjax.__version__)' ``` -------------------------------- ### Install GPJax Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/index.md This bash command installs the GPJax library using pip. Ensure you have Python and pip installed. ```Bash pip install gpjax ``` -------------------------------- ### Run All Tests with Poe Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/static/CONTRIBUTING.md This command executes all unit tests for GPJax using the 'poe' task runner. It's recommended to run tests after installation to verify the setup. ```bash uv run poe all-tests ``` -------------------------------- ### Install GPJax Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/README.md Instructions for installing the GPJax library, typically via pip or conda. This is a prerequisite for using the library's functionalities. ```shell pip install GPJax ``` ```shell conda install -c conda-forge gpjax ``` -------------------------------- ### Install Dependencies with uv Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/contributing.md This command installs the project's development dependencies using uv, a fast Python package and virtual environment manager. ```bash $ uv sync --extra dev ``` -------------------------------- ### Install GPJax Stable Version Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/README.md Installs the latest stable version of GPJax from PyPI using pip. This is the recommended method for most users. ```bash pip install gpjax ``` -------------------------------- ### Install GPJax and Dependencies with uv Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/static/CONTRIBUTING.md This command installs GPJax and its development dependencies using 'uv', a modern Python package and virtual environment manager. It ensures your project is set up correctly for development. ```bash uv sync --extra dev ``` -------------------------------- ### Install GPJax with Conda-forge Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/README.md Installs GPJax from the conda-forge channel using either Pixi or Conda. This is an alternative installation method for users who prefer conda environments. ```bash # with Pixi pixi add gpjax # or with conda conda install --channel conda-forge gpjax ``` -------------------------------- ### Clone GPJax Repository and Install Development Version Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/README.md Clones the GPJax repository from GitHub and installs it in development mode using uv. This is for users who want to work with the latest code or contribute to the project. ```bash git clone https://github.com/JaxGaussianProcesses/GPJax.git cd GPJax uv venv uv sync --extra dev ``` -------------------------------- ### Check GPJax Installation Version Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/README.md Verifies the installed version of GPJax by running a Python command. This is a good practice to ensure the correct version is installed. ```python python -c 'import gpjax; print(gpjax.__version__)' ``` -------------------------------- ### Run GPJax Unit Tests Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/README.md Executes all unit tests for GPJax using the 'poe all-tests' command via uv. This ensures the installation is working correctly and helps catch potential issues. ```python uv run poe all-tests ``` -------------------------------- ### Convert Python to Jupyter Notebook Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/README.md This command converts a Python script into a Jupyter Notebook using Jupytext. It's useful for managing and sharing code examples. ```bash jupytext --to notebook example.py ``` -------------------------------- ### JAX vs NumPy PRNG Comparison Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/sharp_bits.md Demonstrates the difference between JAX's stateless PRNG and NumPy's stateful PRNG. JAX requires explicit key splitting for different random sequences, ensuring reproducibility. ```Python import numpy as np import jax.random as jr key = jr.key(123) # NumPy print('NumPy:') print(np.random.random()) print(np.random.random()) print('\nJAX:') print(jr.uniform(key)) print(jr.uniform(key)) print('\nSplitting key') key, subkey = jr.split(key) print(jr.uniform(subkey)) ``` ```Console NumPy: 0.5194454541172852 0.9815886617924413 JAX: 0.95821166 0.95821166 Splitting key 0.23886406 ``` -------------------------------- ### Run All Tests Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/contributing.md Executes all the project's unit tests using the 'poe' task runner, ensuring your changes do not break existing functionality. ```bash $ uv run poe all-tests ``` -------------------------------- ### Stage and Commit Changes Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/contributing.md Shows how to stage modified files and commit them to your local repository, recording your development progress. ```bash $ git add modified_files $ git commit ``` -------------------------------- ### Stage and Commit Changes Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/static/CONTRIBUTING.md This snippet shows how to stage modified files using 'git add' and then commit them locally with 'git commit'. This records your changes before pushing them. ```bash git add modified_files git commit ``` -------------------------------- ### Clone GPJax Repository and Set Upstream Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/static/CONTRIBUTING.md This snippet demonstrates how to clone your GPJax fork and add the base repository as a remote. This is a crucial step for synchronizing your local development with the main project. ```bash git clone git@github.com:/GPJax.git cd GPJax git remote add upstream git@github.com:GPJax.git ``` -------------------------------- ### Create and Activate GPJax Development Environment Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/README.md Sets up a dedicated Conda virtual environment for GPJax development with Python 3.10.0. This isolates dependencies and prevents conflicts. ```bash conda create -n gpjax_experimental python=3.10.0 conda activate gpjax_experimental ``` -------------------------------- ### Create a Feature Branch Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/contributing.md Demonstrates how to create a new branch for your development work, which is a recommended practice to avoid modifying the main branch directly. ```bash $ git checkout -b my-feature ``` -------------------------------- ### Check Test Coverage with Poe Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/static/CONTRIBUTING.md This command runs the test coverage check using the 'poe' tool. After execution, navigate to the 'htmlcov' folder and open 'index.html' to view the coverage report. ```bash $ uv run poe coverage ``` -------------------------------- ### Check Test Coverage with Poe Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/contributing.md This command runs the test coverage check using the 'poe' tool. After execution, navigate to the 'htmlcov' folder and open 'index.html' to view the coverage report. ```bash $ uv run poe coverage ``` -------------------------------- ### JIT Compile Function with Assertions using checkify in GPJax Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/sharp_bits.md Illustrates how to JIT compile a function containing assertions (which would normally break JIT) using JAX's `checkify` decorator. This allows functions with parameter checks to be compiled for performance. ```Python from jax.experimental import checkify jit_compute_gram = jax.jit(checkify.checkify(compute_gram)) try: error, value = jit_compute_gram(1.0) except Exception as e: print(e) ``` -------------------------------- ### Clone GPJax Repository and Set Upstream Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/contributing.md This snippet shows how to clone your GPJax fork and add the upstream repository as a remote for keeping your local copy updated. ```bash $ git clone git@github.com:/GPJax.git $ cd GPJax $ git remote add upstream git@github.com:GPJax.git ``` -------------------------------- ### Convert Jupyter Notebook to Python Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/README.md This command converts a Jupyter Notebook back into a Python script using Jupytext. It supports the py:percent format for storing notebooks as plain text files. ```bash jupytext --to py:percent example.ipynb ``` -------------------------------- ### Push Feature Branch to Origin Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/contributing.md Uploads your local feature branch and its commits to your GitHub fork, making them available for creating a pull request. ```bash $ git push -u origin my-feature ``` -------------------------------- ### Sync with Upstream and Rebase Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/contributing.md Fetches changes from the upstream repository and rebases your feature branch onto the latest main branch to integrate updates. ```bash $ git fetch upstream $ git rebase upstream/main ``` -------------------------------- ### Synchronize with Upstream and Push Feature Branch Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/static/CONTRIBUTING.md This sequence of commands fetches the latest changes from the upstream repository, rebases your feature branch onto the main branch, and then pushes your changes to your GitHub fork. This ensures your contributions are up-to-date and correctly submitted. ```bash git fetch upstream git rebase upstream/main git push -u origin my-feature ``` -------------------------------- ### Create a Feature Branch Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/static/CONTRIBUTING.md This command creates a new branch for your development work, following best practices to avoid direct modifications to the main branch. This ensures a clean and organized contribution process. ```bash git checkout -b my-feature ``` -------------------------------- ### Identifying the Matrix for Solving Linear Systems Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/sharp_bits.md Highlights the specific matrix term \(\left(\\mathbf{K}_{\\boldsymbol{xx}} + \\sigma^2\\mathbf{I} \\right)^{-1}\) within the Gaussian Process log-likelihood calculation, which is often represented as \(\mathbf{A}\) when solving linear systems. ```math \begin{align} \\underbrace{\\left(\\mathbf{K}_{\\boldsymbol{xx}} + \\sigma^2\\mathbf{I} \\right)^{-1}}_{\\mathbf{A}}\\boldsymbol{y}, \\end{align} ``` -------------------------------- ### Define GPJax Prior and Likelihood Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/index.md This Python snippet demonstrates how to define a Gaussian Process prior with a zero mean function and an RBF kernel, and a Gaussian likelihood. It then combines them to create a posterior. ```Python import gpjax as gpx mean = gpx.mean_functions.Zero() kernel = gpx.kernels.RBF() prior = gpx.gps.Prior(mean_function = mean, kernel = kernel) likelihood = gpx.likelihoods.Gaussian(num_datapoints = 123) posterior = prior * likelihood ``` -------------------------------- ### Gaussian Process Marginal Log-Likelihood Formula Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/sharp_bits.md Presents the mathematical form of the marginal log-likelihood for a Gaussian Process regression setting. This formula is central to hyperparameter optimization in GP models. ```math \begin{align} \\log p(\\boldsymbol{y}) = 0.5\left(-\\boldsymbol{y}^{\\top}\\left(\\mathbf{K}_{\\boldsymbol{xx}} + \\sigma^2\\mathbf{I} \\right)^{-1}\\boldsymbol{y} -\\log\lvert \\mathbf{K}_{\\boldsymbol{xx}} + \\sigma^2\\mathbf{I}\\rvert -n\\log(2\\pi)\right) , \\end{align} ``` -------------------------------- ### Compute Gram Matrix with RBF Kernel in GPJax Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/sharp_bits.md Demonstrates how to compute a Gram matrix using the Radial Basis Function (RBF) kernel from GPJax. It initializes the kernel with specified active dimensions, lengthscale, and variance, then applies it to input data. ```Python import jax import jax.numpy as jnp import gpjax as gpx x = jnp.linspace(0, 1, 10)[:, None] def compute_gram(lengthscale): k = gpx.kernels.RBF(active_dims=[0], lengthscale=lengthscale, variance=jnp.array(1.0)) return k.gram(x) compute_gram(1.0) ``` -------------------------------- ### Cholesky Factorization of a Symmetric Positive-Definite Matrix Source: https://github.com/jaxgaussianprocesses/gpjax/blob/main/docs/sharp_bits.md Demonstrates the Cholesky decomposition of a symmetric positive-definite matrix \(\mathbf{\Sigma}\) into \(\mathbf{L}\mathbf{L}^{\top}\), where \(\mathbf{L}\) is a lower triangular matrix. This is fundamental for optimizing operations on covariance matrices in Gaussian Processes. ```math \begin{align} \\mathbf{\\Sigma} = \\mathbf{L}\\mathbf{L}^{\\top}\\, \\end{align} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.