This issue comes from a Codex global repository scan.
Problem
The vendored MCMC custom sampler computes a post-burn-in state, then discards it and collects the wrong number of samples:
|
x, dtype, device = _mhcustom_sample(logpfcn, x0, pparams, nburnout, custom_step, False) |
|
xsamples = _mhcustom_sample(logpfcn, x0, pparams, nburnout, custom_step, True) |
It calls _mhcustom_sample(..., x0, ..., nburnout, ..., True) instead of starting from x and collecting nsamples. Whenever nsamples != nburnout, the returned chain has the wrong length and starts from the unburned initial state.
Reproduction
Use custom_step=lambda x: x + 1, x0=0, nsamples=3, and nburnout=2; the current output has length 2 and starts at [0, 1].
Suggested fix
Collect from the burned-in state and use nsamples:
xsamples = _mhcustom_sample(logpfcn, x, pparams, nsamples, custom_step, True)
This issue comes from a Codex global repository scan.
Problem
The vendored MCMC custom sampler computes a post-burn-in state, then discards it and collects the wrong number of samples:
dftio/dftio/dep/_xitorch/_impls/integrate/mcsamples/mcmc.py
Lines 76 to 77 in c9d128f
It calls
_mhcustom_sample(..., x0, ..., nburnout, ..., True)instead of starting fromxand collectingnsamples. Whenevernsamples != nburnout, the returned chain has the wrong length and starts from the unburned initial state.Reproduction
Use
custom_step=lambda x: x + 1,x0=0,nsamples=3, andnburnout=2; the current output has length 2 and starts at[0, 1].Suggested fix
Collect from the burned-in state and use
nsamples: