CUQI-DTU / CUQIpy

https://cuqi-dtu.github.io/CUQIpy/
Apache License 2.0
48 stars 9 forks source link

Samplers accept invalid proposals #494

Closed chaozg closed 2 months ago

chaozg commented 3 months ago

Description

With a bounded prior, invalid proposals are accepted after a MH step. This happens to all samplers involving a MH step.

As seen in the following plot, an invalid proposal, negative here, is accepted after a MH step, which is not supposed to happen, and then the sampler gets stuck there.

Example to reproduce

import cuqi
beta = cuqi.distribution.Beta(0.5, 0.5)
simpler = cuqi.sampler.MALA(beta, x0=0.1, scale=0.1)
simples = simpler.sample(1000, 0)
plt.plot(simples.samples.T[:10])

bug

DoD

chaozg commented 2 months ago

@nabriis , I just want to draw your attention to this issue since you were not at the standup when I briefly reported it.

chaozg commented 2 months ago

Hi @jakobsj could you review the DoD here?

jakobsj commented 2 months ago

DoD approved!