Potential for log_prob / grad_log_prob in cmdstanr


Thanks @jonah @rok_cesnovar for cmdstanr (and many others behind the scenes I’m sure) - the improvement in complication time is legitimately amazing.

I tend to use Stan to evaluate arbitrary log-densities, as I do a lot of Gibbs updates, and need to control certain aspects of the proposal. This means I use log_prob quite a lot (ex: here where I use Stan as a log-posterior evaluator and as a way to perform a Gibbs update, and here where I just use it as a log-posterior evaluator).

Early days, but do you intend to add log_prob and/or grad_log_prob methods to the CmdStanModel object?

Thanks again!


Are those repos private?

For the features you ask we need some kind of ServerStan which is on the roadmap, but will take some time before it’s available for CmdStanR.

1 Like

Not anymore - I meant to make them public when I gave a talk two weeks ago, but clearly did not!

Interesting! That makes sense, interacting with the compiled Stan object/model is definitely a different thing.

1 Like

@hhau Glad you like CmdStanR!

Yeah unfortunately we won’t have this via CmdStanR in the super short term but like Aki says it’s on the roadmap.


I was wondering if @avehtari or anyone could give an update on the prospects for grad_log_prob() support in CmdStanR?

I’m finalising this cmdstan PR this week, which will add log_prob and grad_log_prob functionality to the stan executable. Once that’s in I’ll be exposing the method in cmdstanr, so it should be available in the near future


That is amazing to hear!

1 Like