Comments (3)
Notes to self as I start working on this...
We might consider first adding some tests that ensure that our kernel approximations come close to matching the exact versions for m
large enough. Something like the following:
from sklearn.gaussian_process.kernels import RBF
import jax.numpy as jnp
from numpyro.contrib.hsgp.laplacian import eigenfunctions, sqrt_eigenvalues
from numpyro.contrib.hsgp.spectral_densities import (
diag_spectral_density_squared_exponential,
)
x1 = jnp.array([1.0, 1.0])[None, ...]
x2 = jnp.array([0.0, 0.0])[None, ...]
m = 10
ell = 3
sqrt_eig_v = sqrt_eigenvalues(ell=ell, m=m, dim=2)
eig_f1 = eigenfunctions(x1, ell=ell, m=m)
eig_f2 = eigenfunctions(x2, ell=ell, m=m)
spd = diag_spectral_density_squared_exponential(1.0, 1.0, ell, m, 2)[None, ...]
approx = (eig_f1 * eig_f2 * spd).sum(axis=1)
exact = RBF(1.0)(x1, x2)
assert jnp.isclose(approx, exact)
from numpyro.
I'd be interested in finishing this up if you're not too far along! For the squared exponential at least, I'd assume we can do something like the following:
def spectral_density_squared_exponential(
dim: int, w: ArrayImpl, alpha: float, length: float | ArrayImpl
) -> float:
...
length = jnp.broadcast_to(length, dim)
c = alpha * jnp.prod(jnp.sqrt(2 * jnp.pi) * length)
e = jnp.exp(-0.5 * jnp.sum(w**2 * length**2))
return c * e
This would allow for the current behavior, but also let us have different length-scales for each dimension.
I could add tests like you describe above to the test/contrib/hsgp/test_approximation.py
file.
from numpyro.
@samanklesaria go for it! Perhaps we can swap ideas and merge implementations. I have a little bit of wip here. I would like to try and support batch dimensions on the lengthscale to enable batched approx GPs, in addition lengthscale heterogeneity within a single GP. Just need to work out the API a bit. I have a working example with a few tests on that branch. Still need to do the Matern case, and maybe periodic as well.
For a use case on the batching, see hsgp_lvm.ipynb on this branch
from numpyro.
Related Issues (20)
- `TransformedDistribution` support too broad when using `AffineTransform` transformation? HOT 2
- Correct control_flow.cond usage HOT 6
- Factor Analysis/PPCA Tutorial HOT 1
- Censoring Example HOT 1
- numpyro.deterministic static on infer.Predictive HOT 13
- [FR] Support for different supports in component distributions for mixture models HOT 5
- ImportError: cannot import name 'CAR' from "numpyro.distrubutions.continuous' HOT 2
- Use biased autocorrelation estimate by default HOT 1
- mean_accept_prob significantly different after warmup HOT 8
- HSGP utility functions in the `contrib` module? HOT 2
- Add Pareto Smoothed Importance Sampling (PSIS) diagnostic method
- [FR] Truncated Power Law distribution
- An auto guide's `_unpack_latent` and `_unpack_latent._inverse` don't use produce the same order HOT 1
- [FR] Utility for joint distributions HOT 14
- How can I gibbs before HMC/NUTS? HOT 8
- Large potential energy while using `HMCGibbs` at the initial stage HOT 3
- Inference Test Failing HOT 2
- Figure in AR2 example is not reproducible
- Got Problems When Computing Log Likelihoods in a Scan-Based VAR Model HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from numpyro.