-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e2b4cf
commit 216e0c5
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import sys | ||
import pytest | ||
import numpy as onp | ||
import jax.numpy as jnp | ||
import jax | ||
import numpyro | ||
import numpyro.distributions as dist | ||
from numpy.testing import assert_equal, assert_array_equal, assert_ | ||
|
||
sys.path.insert(0, "../gpax/") | ||
|
||
from gpax.models.uigp import UIGP | ||
from gpax.utils import get_keys | ||
|
||
|
||
def get_dummy_data(): | ||
X = onp.linspace(1, 2, 8) + 0.1 * onp.random.randn(8,) | ||
X_prime = onp.random.normal(X, 0.1) | ||
y = (10 * X_prime**2) | ||
return jnp.array(X_prime), jnp.array(y) | ||
|
||
|
||
def test_fit(): | ||
rng_key = get_keys()[0] | ||
X, y = get_dummy_data() | ||
m = UIGP(1, 'RBF') | ||
m.fit(rng_key, X, y, num_warmup=10, num_samples=10) | ||
assert m.mcmc is not None |