On Oct 8, 2014, at 4:26 AM, John Reid <
johnba...@gmail.com> wrote:
> On 07/10/14 22:17, Bob Carpenter wrote:
>> On Oct 7, 2014, at 2:28 PM, John Reid <
johnba...@gmail.com> wrote:
> If I code my model in Stan and
> then write the initialisation function in R, I often have to transform
> between different parameterisations.
Different parameterizations of the model in Stan?
The inits are always on the constrained scale.
> Perhaps there could be some sort of
> "parameter initialisation" block in Stan models so this wouldn't be
> necessary.
This is something that we had in the works before our adaptation
got a lot more robust. We may still do it at some point.
> Sharing user-defined functions between this block and the
> model could be useful.
Agreed.
We plan to add the transform functions as built-ins soon along with all of
our internal error checking.
> Also if custom initialisation is so useful for
> good inference
If custom initialization is really necessary, it may signal
a problem with inference in the model as Daniel pointed out.
> it would be nice to include the initialisations used with
> the definition of the model.
Definitely.
>> But I'd imagine in cases where what you're suggesting would
>> work, Stan would also be able to just converge.
>>
>> Do you have non heavily multimodal examples where initialization
>> makes a big difference? If so, we'd love to collect them as
>> test cases.
> You've hit the nail on the head, my examples have multi-modal
> posteriors. I believe initialising from the prior allows the sampler to
> have a much greater chance of visiting more of the modes.
That will depend on whether unconstraining uniform(-2,2) or
the prior is more dispersed and other factors about the posterior
curvature.
In any case, you may visit more, but it's going to be impossible
to do proper Bayesian inference in highly multimodal posteriors.
We'll be adding Michael Betancourt's thermodynamic sampling (arXiv-ed),
which will probably help with a lot of these issues.
We may also may wind up doing some kind of tempered optimization,
which may be more relevant for inference under multiple modes.
> I'm trying to
> learn a latent temporal variable that explains the data well. Each datum
> has a latent pseudotime and the model's parameters are allowed to
> smoothly vary over this pseudotime. The initialisation of the data
> pseudotime parameters seems very important as Stan has trouble
> reordering the data during sampling. I guess that's not the sort of
> example you're looking for.
These are the sorts of examples we're looking for.
Unfortunately, anything with modes separated by low density
troughs is going to be pretty much impossible to mix in
practice. Like the mixture models in the manual: K-means
clustering, HMMs, and LDA. And even if you could mix, the
combinatorics will prevent proper posterior inference unless
one mode is so dominant the others can be ignored.
In this particular case, if the ordering is known, we have
a constrained parameter for ordered input.
- Bob