Krzysztof:
I completely agree that hte names of arguments should be
consistent, even if "_" isn't as idiomatic in R as "." as
a separator.
I do not want to build a typical R function, just one that
uses data types that are familiar from R, such as lists,
etc., and that returns output in the form usable in R, such
as a reference object.
Allen and Michael:
I'm not sure how to do that in a transparent way without
having the glue:
R command
-> C++ config object
-> Stan C++ validator
-> Stan C++ optimization, sampling, or validation
-> C++ result object
Michael:
Do you object to all the additional functions inside R,
like extract() and what not? Or do you object to the
what Ben's calling "andrewfy", which was formerly referred
to by Andrew as "Sebastian's function"? That is, something
that provides make-like behavior inside the stan() call?
Or are you insisting on a separate make() then run call?
I'm OK with the latter, but RStan's going down the former
path.
What we really need is a spec from you as to what RStan
and PyStan interfaces would look like. I lack the imagination
to envsion what you're talking about other than what I put
in the previous message. Is the lack of a counter-proposal
implicit acknowledgment that what I wrote is what you'd like
to see in RStan?
What kind of drift are you talking about specifically?
More below.
> On Mar 19, 2015, at 1:18 AM, Michael Betancourt <
betan...@gmail.com> wrote:
>
>> I'm ok with the idea of having a config that's parsed, but I think we
>> need to separate out the configuration for the algorithms vs the
>> configuration that's needed to handle implementation of these things
>> that need to be passed in.
>
> Agreed, sorry if that wasn’t clear earlier. I was defining
> config as the config of the algorithms, not the callbacks
> the interfaces have to define.
>
>> Sure, but it's even more uniform if there was a small function that
>> exposed doubles instead, right?
>
> Example?
I think the main issue here is whether the config is
* a string wrapping up the command-line interface,
* a structured protocol buffer
- with data
- without data
* a C++ object
I've been arguing for the C++ object approach, but Allen thinks
it's complicated to do that from PyStan (for reasons I don't
undersetand enough about Python to understand).
Whatever we do, CmdStan is going to make a call to make to
build the model (either wrapped up in another function, or
expicitly called as make as the CmdStan manual suggests now).
Whatever else we do, RStan and PyStan are going to need an
R and Python function to call respectively.
Is it really that hard to validate input from the interfaces?
There's almost no consistency issues from a lower-level interface
standpoint (that is, once you specify
method=sample algorithm=hmc engine=nuts
The one thing that would be nice for the C++ structure or
protocol buffers that Allen brought up is consistent
unions (aka variant data types). There's a nice
implementation in Boost that uses only static types, but it's a
bit of a pain to use because every function has to be defined
via callbacks. And there's the compile-time hit because of all
the templates.
>> I'm not suggesting that. I'm suggesting that there are lots of smaller
>> functions and there's a single large function that RStan, PyStan, and
>> CmdStan share. But, I can already imagine CmdStan wanting to build an
>> executable that only includes NUTS or only includes optimization.
>
> I agree that command should be split up into smaller functions
> for easier testing (that part is already happening — which should
> make it easier to test each function and also make it easier to
> create tests that require running the algorithms, such as the
> statistical validation tests) but I still think that the single large
> function should be the only official “route” exposed to the
> interfaces.
What I really dislike about this is the fact that it has
a polymorphic return. You get one set of output from optimize
and a different one from validate and a third one from
optimize.
I dislike even more the R idiom of just defining a massive
structure and partially populating it on return. Especially
the way it's used in something like glm to be mutable without
enforcing consistency.
> In other words, the Stan C++ API would expose all the little
> functions but if you want to be an official Stan interface then
> you have to use the big interface function that wraps all of
> them up into a singular user experience.
If we do this (and I don't like it), then I agree that
we'd want to have the interfaces pass in a giant string.
Michael --- you still haven't said what you want that function
to look like from the RStan or PyStan side. Until we have
an example of that, it's hard to talk about whether it's acceptable
to R/Python users or not.
- Bob