MCPcopy
hub / github.com/GPflow/GPflow / test_log_prior_for_uniform_prior

Function test_log_prior_for_uniform_prior

tests/gpflow/test_base_prior.py:56–68  ·  view source on GitHub ↗

If we assign a Uniform prior to a parameter, we should not expect the value of the prior density to change with the parameter value, even if it has a transform associated with it.

()

Source from the content-addressed store, hash-verified

54
55
56def test_log_prior_for_uniform_prior() -> None:
57 """
58 If we assign a Uniform prior to a parameter, we should not expect the value of the prior density
59 to change with the parameter value, even if it has a transform associated with it.
60 """
61
62 uniform_prior = Uniform(low=np.float64(0), high=np.float64(100))
63 param = gpflow.Parameter(1.0, transform=gpflow.utilities.positive(), prior=uniform_prior)
64 low_value = param.log_prior_density().numpy()
65 param.assign(10.0)
66 high_value = param.log_prior_density().numpy()
67
68 assert np.isclose(low_value, high_value)
69
70
71def test_log_prior_on_unconstrained() -> None:

Callers

nothing calls this directly

Calls 2

log_prior_densityMethod · 0.95
assignMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…