Constant Kernel does not work within Numpyro plate
See original GitHub issueSee title, bellow code will cause the error. If you remove the Constant
kernel it seems to run fine, but errs out that the Constant is not a constant otherwise (but really it is)
with numpyro.plate('Clusters', max_clusters):
mean = numpyro.sample("mean", dist.Normal(1.0, 5))
expo_len = numpyro.sample("expo_len", dist.HalfNormal(5))
k = kernels.ExpSquared(expo_len)
k = k + kernels.Constant(mean)#comment out this line and it runs fine
t = jnp.arange(1, 11)/10-1/20
gp = GaussianProcess(k, t)
p = sample("gp", gp.numpyro_dist())
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
ZeroInflatedDistribution Errors with continuous/discrete ...
If I build a model as def model(X, Y): print("Start:", X.shape, Y.shape) N = Y.shape[0] with numpyro.plate('N', N): v = sample('v', dist.
Read more >Pyro Primitives - NumPyro documentation
Used to designate deterministic sites in the model. Note that most effect handlers will not operate on deterministic sites (except trace() ), so...
Read more >Getting Started with NumPyro
NumPyro is a lightweight probabilistic programming library that provides a NumPy backend for Pyro. We rely on JAX for automatic differentiation and JIT ......
Read more >Keep latent discrete parameters consistent - numpyro
I'm trying to learn how to infer discrete latent variables from observed continuous data properly in numpyro.
Read more >NumPyro documentation - Pyro
NumPyro is a lightweight probabilistic programming library that provides a NumPy backend for Pyro. We rely on JAX.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This example is useful! I now see the issues, I think, and I’ll be able to give some tips. Let me play around with it a bit and report back.
Minor correction to get the example to work:
gp.scale_tril
doesn’t exist and instead should begp.solver.scale_tril
.Thanks for the helpful example!