A parameter with an Exp transform, and a uniform prior on its unconstrained, should have a prior in the constrained space that scales as 1/value.
()
| 69 | |
| 70 | |
| 71 | def test_log_prior_on_unconstrained() -> None: |
| 72 | """ |
| 73 | A parameter with an Exp transform, and a uniform prior on its unconstrained, should have a |
| 74 | prior in the constrained space that scales as 1/value. |
| 75 | """ |
| 76 | |
| 77 | initial_value = 1.0 |
| 78 | scale_factor = 10.0 |
| 79 | uniform_prior = Uniform(low=np.float64(0), high=np.float64(100)) |
| 80 | param = gpflow.Parameter( |
| 81 | initial_value, |
| 82 | transform=Exp(), |
| 83 | prior=uniform_prior, |
| 84 | prior_on=PriorOn.UNCONSTRAINED, |
| 85 | ) |
| 86 | low_value = param.log_prior_density().numpy() |
| 87 | param.assign(scale_factor * initial_value) |
| 88 | high_value = param.log_prior_density().numpy() |
| 89 | |
| 90 | assert np.isclose(low_value, high_value + np.log(scale_factor)) |
| 91 | |
| 92 | |
| 93 | class DummyModel(gpflow.models.BayesianModel): |
nothing calls this directly
no test coverage detected
searching dependent graphs…