Modeling a Spectrum of Gaussians with SMC

Digging into the code for SMC a bit, the function that constructs the initial population doesn’t appear to respect custom initial values, so you’re going to get an error when you try to use ordered (unless you luck out and get ordered random draws from the unconstrained prior for every single initial draw). In particular, this line:

value = transform.forward(value, *variable.owner.inputs)

Assumes that the values are already in the constrained space (as forward is the transformation to the unconstrained space). For ordered, that means they are 1) ordered, and 2) strictly positive – see here, noting that log function. This isn’t going to be the case for draws from a Normal centered on zero, unless you get supremely lucky.

A better solution for generating ordered draws would be to apply a function to the samples themselves that will enforce the ordering. See here for a discussion.