Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.

Commit e132136

Browse files
committed
Fixups.
1 parent afca912 commit e132136

File tree

6 files changed

+36
-2
lines changed

6 files changed

+36
-2
lines changed
File renamed without changes.

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def check_dependencies():
5555

5656

5757
setup(
58-
name="nmc-numpyro",
58+
name="nmc_numpyro",
5959
version="0.0.1",
6060
author="<at>Johanpdrsn & Emanuele Ballarin",
6161
author_email="emanuele@ballarin.cc",
@@ -73,7 +73,7 @@ def check_dependencies():
7373
],
7474
license="Custom",
7575
packages=[
76-
package for package in find_packages() if package.startswith("nmc-numpyro")
76+
package for package in find_packages() if package.startswith("nmc_numpyro")
7777
],
7878
classifiers=[
7979
"Development Status :: 3 - Alpha",

tests/dev_test.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
4+
#
5+
# (cfr.: http://num.pyro.ai/en/latest/examples/funnel.html)
6+
#
7+
8+
# Installed without `-e` to smooth-out some PyCharm <-> WSL2 oddities
9+
from nmc_numpyro import NMC
10+
11+
from jax import random
12+
import jax.numpy as jnp
13+
14+
import numpyro
15+
import numpyro.distributions as dist
16+
from numpyro.infer import MCMC, NUTS
17+
18+
rng_key = random.PRNGKey(0)
19+
20+
21+
# The used and abused Neal's Funnel
22+
def model(dim=10):
23+
y = numpyro.sample("y", dist.Normal(0, 3))
24+
numpyro.sample("x", dist.Normal(jnp.zeros(dim - 1), jnp.exp(y / 2)))
25+
26+
27+
nuts_kernel = NUTS(model)
28+
nmc_kernel = NMC(model)
29+
30+
mcmc = MCMC(nmc_kernel, num_samples=20, num_warmup=20)
31+
32+
mcmc.run(rng_key)
33+
34+
mcmc.print_summary(exclude_deterministic=False)

0 commit comments

Comments
 (0)