> On Aug 19, 2013, at 7:44 PM, Matt Hoffman <
mdho...@cs.princeton.edu> wrote:
>
>> I agree with Andrew on this. From the perspective of pure, ideal,
>> perfect, computation-free posterior inference, there's no distinction
>> between prior and likelihood, they're just independent terms in the
>> log-posterior. And we've been talking about a variety of situations
>> where we'd like to be able to partition the pieces of the
>> model�besides the PPCs and nested sampling applications mentioned
>> above, if we eventually want to be able to do stochastic inference
>> (e.g. contrastive divergence, stochastic EM, stochastic variational
>> inference) being able to partition the parameters (e.g. into point
>> estimable and nuisance parameters) would be really helpful.
On 8/19/13 4:31 PM, Michael Betancourt wrote:
> Agreed. My current wish list is
>
> 1) Higher-order autodiff
This is our next big project after 2.0. We don't think
it'll be that hard other than the Windows compile issues.
It's already there for everything but the probability
functions. So if you write your model by hand, you can
use it now.
> 2) Parameter tagging
Agreed. This is most general. This should be pretty easy.
> 3) Prior/Likelihood Identification
Identification how? As in different functions in the model,
like if theta is the parameters, defining
log_prior(theta,...)
and
log_likelihood(theta,...);
so that
log_prob(theta,...) = log_prior(theta,...) + log_likelihood(theta,...).
I'm not sure we want every model to have these.
If we had statement tagging, we could identify the pieces in
the model, but I don't see how then to expose the different
functions. Maybe:
log_sub_prob(TAG,theta,...)
?
That would be general enough, I think, and probably also not too
difficult.
> Lots of fun stuff on the horizon.
Indeed!
(More below)
>> On Sun, Aug 18, 2013 at 12:43 PM, Andrew Gelman
>> <
gel...@stat.columbia.edu> wrote:
>>> If so, I like the option of allowing people to give arbitrary names to different segments of their log-posterior. Of course the next step is to allow these to be a vector . . .
>>>
>>> On Aug 18, 2013, at 9:38 PM, Michael Betancourt wrote:
>>>
>>>>> I was thinking more in terms of a single function which computed three values all at once, lp_prior, lp_likelihood and lp_posterior. lp_posterior would be the sum of the other two plus the volume correction terms and anything that was done in a sub-block.
>>>>
>>>> Sure, but you could just as easily have three wrappers:
>>>>
>>>> prior { return lp_prior + Jacobian correction }
>>>> likelihood { return lp_likelihood + Jacobian correction }
>>>> posterior { return lp_prior + lp_posterior + Jacobian correction }
>>>>
>>>>> Getting two vectors out and letting users do their own complex manipulations would be more than adequate.
>>>>>
>>>>> True, but then we'd need the ability to return more than one value from a function which isn't something that's done in the language right now.
>>>>
>>>> Or just return a 2xn matrix.
>>>>
>>>>> But if they defined the distribution on the unconstrained parameters then they don't need the Jacobian. Alternatively, if they defined the distribution on the constrained parameters then why not just use a constrained definition?
>>>>
>>>> There are lots of complex distributions in physics that are naturally defined on contained parameters. Yes, you can define them on unconstrained parameters but that is equivalent to computing and coding in the Jacobian. The idea is to make it much easier for the user by not requiring this additional step.
I think we can do this. It's not on my near-term to-do list
given everything else we have going. We should actually be implementing
part of what we need with the ode solvers, which are going to need
Jacobians computed for arbitrary functions.
What we need is a way to specify it in Stan.
- Bob