Skip to content

Commit 13294a4

Browse files
committed
Add relative error test for collapsed elbo vs mll equivalence on full data.
1 parent d8dc0f2 commit 13294a4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/test_objectives.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,12 @@ def test_collapsed_elbo(
175175
assert isinstance(evaluation, jax.Array)
176176
assert evaluation.shape == ()
177177

178-
# with pytest.raises(TypeError):
178+
# Data on the full dataset should be the same as the marginal likelihood
179+
q = gpx.CollapsedVariationalGaussian(posterior=p * likelihood, inducing_inputs=D.X)
180+
mll = ConjugateMLL(negative=negative)
181+
expected_value = mll(p * likelihood, D)
182+
actual_value = negative_elbo(q, D)
183+
assert jnp.abs(actual_value - expected_value) / expected_value < 1e-6
179184

180185

181186
@pytest.mark.parametrize("num_datapoints", [1, 2, 10])

0 commit comments

Comments
 (0)