mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-06 02:24:17 +02:00
Update rv_transformation_tests.py
This commit is contained in:
parent
03c14d5b6c
commit
e65db81a56
1 changed files with 2 additions and 2 deletions
|
|
@ -34,7 +34,7 @@ class RVTransformationTestCase(unittest.TestCase):
|
||||||
# The PDF of the transformed variables
|
# The PDF of the transformed variables
|
||||||
p_phi = lambda phi : np.exp(-m._objective_grads(phi)[0])
|
p_phi = lambda phi : np.exp(-m._objective_grads(phi)[0])
|
||||||
# To the empirical PDF of:
|
# To the empirical PDF of:
|
||||||
theta_s = prior.rvs(100000)
|
theta_s = prior.rvs(5)
|
||||||
phi_s = trans.finv(theta_s)
|
phi_s = trans.finv(theta_s)
|
||||||
# which is essentially a kernel density estimation
|
# which is essentially a kernel density estimation
|
||||||
kde = st.gaussian_kde(phi_s)
|
kde = st.gaussian_kde(phi_s)
|
||||||
|
|
@ -56,7 +56,7 @@ class RVTransformationTestCase(unittest.TestCase):
|
||||||
# The following test cannot be very accurate
|
# The following test cannot be very accurate
|
||||||
self.assertTrue(np.linalg.norm(pdf_phi - kde(phi)) / np.linalg.norm(kde(phi)) <= 1e-1)
|
self.assertTrue(np.linalg.norm(pdf_phi - kde(phi)) / np.linalg.norm(kde(phi)) <= 1e-1)
|
||||||
# Check the gradients at a few random points
|
# Check the gradients at a few random points
|
||||||
for i in range(10):
|
for i in range(len(theta_s)):
|
||||||
m.theta = theta_s[i]
|
m.theta = theta_s[i]
|
||||||
self.assertTrue(m.checkgrad(verbose=True))
|
self.assertTrue(m.checkgrad(verbose=True))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue