Skip to content
New issue

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

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

Already on GitHub? # to your account

Add quadratic-type means & implement linear operations for means #2428

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

pjpollot
Copy link

@pjpollot pjpollot commented Oct 26, 2023

Quadratic mean for GP models

Overview

Standard version

$$ \mu (x) = x A x^\top, $$

$$ \nabla \mu (x) = \frac12 x (A + A^\top), $$

$$ \nabla^2 \mu(x) = A. $$

Positive version

We define $A = L L^\top$ and $L$ is a lower triangular matrix. We also that the gradient becomes $\nabla \mu(x) = x A$ as A is now symmetric, and the Hessian remains unchanged.

Linear operations

Add the possibilities to do linear operations with means. For all mean modules $\mu, \nu$ and for all $\lambda \in \mathbb{R}$, we can define the following mean:

$$ \eta(x) := \mu(x) + \lambda \cdot \nu(x) $$

$$ = \mu(x) + \nu(x) \cdot \lambda. $$

It is especially useful to combine a linear mean with a quadratic mean.

Motivation

Using a quadratic mean could be an interesting alternative to a Polynomial kernel of degree two, reducing the risk getting less singular matrixes when fitting a GP model to some rough training datasets by considering simpler kernels conjointly with this mean module.

Checklist

  • Add the gradient and the hessian
  • Allow linear operations (esp. Quadratic + Linear)
  • Add unit tests
  • Give examples in 1D
  • Check if the documentation is well generated

I have run pip install -e . but I cannot generate locally the docs. Do you have any idea on how to install all the dependencies correctly for sphinx?

Ideas for further PRs

  • Reduce the number of files inside the means folder, e.g. gather *.py, *_grad.py and *_gradgrad.py into a single file.
  • Refactor the unit tests for means as the base test for means is always re-implemented. We could think of a way to shorten the boiler plate code.

Example

access to the notebook

zero
constant
linear
positive quadratic
-positive quadratic
quadratic
linear - positive quadratic
linear + positive quadratic
linear + quadratic

@pjpollot pjpollot changed the title Add quadratic mean Add quadratic mean & allow means summation and subtraction Oct 29, 2023
@pjpollot pjpollot changed the title Add quadratic mean & allow means summation and subtraction Add quadratic mean & implement means summation and subtraction Oct 29, 2023
@pjpollot pjpollot changed the title Add quadratic mean & implement means summation and subtraction Add quadratic-type means & implement linear operations for means Oct 30, 2023
@pjpollot pjpollot marked this pull request as ready for review October 30, 2023 08:49
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant