Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions numpyro/examples/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
dset = namedtuple("dset", ["name", "urls"])

BASEBALL = dset(
"baseball", ["https://d2hg8soec8ck9v.cloudfront.net/datasets/EfronMorrisBB.txt"]
"baseball",
["https://github.com/pyro-ppl/datasets/blob/master/EfronMorrisBB.txt?raw=true"],
)

BOSTON_HOUSING = dset(
Expand All @@ -37,7 +38,7 @@
)

COVTYPE = dset(
"covtype", ["https://d2hg8soec8ck9v.cloudfront.net/datasets/covtype.zip"]
"covtype", ["https://github.com/pyro-ppl/datasets/blob/master/covtype.npz?raw=true"]
)

DIPPER_VOLE = dset(
Expand All @@ -48,26 +49,32 @@
MNIST = dset(
"mnist",
[
"https://d2hg8soec8ck9v.cloudfront.net/datasets/mnist/train-images-idx3-ubyte.gz",
"https://d2hg8soec8ck9v.cloudfront.net/datasets/mnist/train-labels-idx1-ubyte.gz",
"https://d2hg8soec8ck9v.cloudfront.net/datasets/mnist/t10k-images-idx3-ubyte.gz",
"https://d2hg8soec8ck9v.cloudfront.net/datasets/mnist/t10k-labels-idx1-ubyte.gz",
"https://github.com/pyro-ppl/datasets/blob/master/mnist/train-images-idx3-ubyte.gz?raw=true",
"https://github.com/pyro-ppl/datasets/blob/master/mnist/train-labels-idx1-ubyte.gz?raw=true",
"https://github.com/pyro-ppl/datasets/blob/master/mnist/t10k-images-idx3-ubyte.gz?raw=true",
"https://github.com/pyro-ppl/datasets/blob/master/mnist/t10k-labels-idx1-ubyte.gz?raw=true",
],
)

SP500 = dset("SP500", ["https://d2hg8soec8ck9v.cloudfront.net/datasets/SP500.csv"])
SP500 = dset(
"SP500", ["https://github.com/pyro-ppl/datasets/blob/master/SP500.csv?raw=true"]
)

UCBADMIT = dset(
"ucbadmit", ["https://d2hg8soec8ck9v.cloudfront.net/datasets/UCBadmit.csv"]
"ucbadmit",
["https://github.com/pyro-ppl/datasets/blob/master/UCBadmit.csv?raw=true"],
)

LYNXHARE = dset(
"lynxhare", ["https://d2hg8soec8ck9v.cloudfront.net/datasets/LynxHare.txt"]
"lynxhare",
["https://github.com/pyro-ppl/datasets/blob/master/LynxHare.txt?raw=true"],
)

JSB_CHORALES = dset(
"jsb_chorales",
["https://d2hg8soec8ck9v.cloudfront.net/datasets/polyphonic/jsb_chorales.pickle"],
[
"https://github.com/pyro-ppl/datasets/blob/master/polyphonic/jsb_chorales.pickle?raw=true"
],
)

HIGGS = dset(
Expand Down Expand Up @@ -129,7 +136,7 @@ def _load_boston_housing():
def _load_covtype():
_download(COVTYPE)

file_path = os.path.join(DATA_DIR, "covtype.zip")
file_path = os.path.join(DATA_DIR, "covtype.npz")
data = np.load(file_path)

return {"train": (data["data"], data["target"])}
Expand Down
2 changes: 1 addition & 1 deletion test/infer/test_autoguide.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def model(x, y):
b = numpyro.sample("b", dist.Normal(0, 10).expand([3]).to_event())
mu = a + b[0] * x + b[1] * x**2 + b[2] * x**3
with numpyro.plate("N", len(x)):
numpyro.sample("y", dist.Normal(mu, 0.001), obs=y)
numpyro.sample("y", dist.Normal(mu, 0.00001), obs=y)

x = random.normal(random.PRNGKey(0), (3,))
y = 1 + 2 * x + 3 * x**2 + 4 * x**3
Expand Down
2 changes: 1 addition & 1 deletion test/test_distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,7 @@ def test_entropy_categorical():
probs = _to_probs_multinom(logits)
sp_dist = osp.multinomial(1, probs)
for jax_dist in [dist.CategoricalLogits(logits), dist.CategoricalProbs(probs)]:
assert_allclose(jax_dist.entropy(), sp_dist.entropy())
assert_allclose(jax_dist.entropy(), sp_dist.entropy(), rtol=1e-6, atol=1e-6)


def test_mixture_log_prob():
Expand Down
2 changes: 1 addition & 1 deletion test/test_example_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def mean_pixels(i, mean_pix):
def test_sp500_data_load():
_, fetch = load_dataset(SP500, split="train", shuffle=False)
date, value = fetch()
assert jnp.shape(date) == jnp.shape(date) == (2427,)
assert jnp.shape(date) == jnp.shape(date) == (2517,)


def test_jsb_chorales():
Expand Down
2 changes: 1 addition & 1 deletion test/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def test_bijective_transforms(transform, shape):
if isinstance(transform, less_stable_transforms):
atol = 1e-2
elif isinstance(transform, (L1BallTransform, RecursiveLinearTransform)):
atol = 0.1
atol = 0.2
assert jnp.allclose(x1, x2, atol=atol)

log_abs_det_jacobian = transform.log_abs_det_jacobian(x1, y)
Expand Down