On 9/30/13 9:03 AM, Allen Riddell wrote:
> Hi,
>
> Even after spending plenty of time in the rstan code I find it challenging
> keeping things straight. Please correct me if I've got the details wrong here.
I hope Jiqiang can help with code details. Everything below
from me is just a design comment (with a hedge about C++ and
Python coding conventions, neither of which I know).
> There's a stan_fit C++ class, an R stan_fit class (I found myself wishing these
> didn't have the same name). Then there's an R stan_model class and there's also
> a stan_model<.......> C++ class.
I like the name parallelism as long as the R class is just
a thin wrapper around the C++ class, perhaps with some
utility methods attached related to R.
> There's other small sources of confusion such as, log_prob of the *model* is
> exposed in the stan_fit C++ object.
This is something that makes most sense to me to have
on the model class. The fit holds a reference to the model
class, so the way I'd like to see it used is to get the model
from the fit, then evaluate the log prob with the model.
But R has what seem to me a number of unusual conventions.
It's more conventional to have a very large function with
all kinds of configuation defaults and dependencies than a bunch
of modular building blocks. And in many ways this makes sense
for the call to the sampler, which has all kinds of config attached
to it, all of which has a default behavior.
> In PyStan there's only a single stan_fit class. It *is* the C++ and Python class
> simultaneously since Cython lets you tack on Python objects to C++ instances.
> This turns out to be have been a mistake for parallel processing, so I'm going
> to have to rewrite things along RStan lines. But at least the separation between
> the classes will be clear since Python uses CamelCase. The Python classes are
> StanModel and StanFit; the C++ classes are stan_model<....> and stan_fit.
I did Java for 10 years, so I kind of miss camel case.
Most C++ doesn't even use capital letters.
- Bob