HI John,

CmdStan is the (C++) command line user interface to work with Stan, the 
equivalent of what PyStan is for Python  and RStan for R. My remark reflected 
recent issues where the feature set in RStan and CmdStan diverted slightly as 
these interfaces are never 'just' user interfaces but often contain some other 
functionality.

The primary motivation to use C++ FFI remains to access a few features inside 
Stan that are not exposed at this point in time, e.g. the Stan code to 
transform from constrained to unconstrained space (where the sampling occurs) 
and back. For Bernoulli in the Stan.jl examples directory that is very simple 
(invlogit) and its included in the bernoulli.jl example. But in general this 
could be more complicated.

Although C++ FFI could indeed be used to drop CmdStan (and that might well be 
the direction to take, time will tell), with the availabilty of capable, and 
able to expand, pure Julia alternatives such as MCMC.jl and Mamba.jl, efforts 
put into those and similar packages might give more bang for the buck. With the 
recent introduction of Stan user functions in Stan v2.3.0 I believe this is 
more true than ever (e.g. see also Brian's introduction to Mamba.jl - 
http://mambajl.readthedocs.org/en/latest/intro.html#the-mamba-package ).

Regards,
Rob J. Goedman
[email protected]




On Jul 9, 2014, at 8:45 AM, John Myles White <[email protected]> wrote:

> I’m not sure I understand how a C++ FFI affects whether we’re interchangeable 
> with Stan or CmdStan. Isn’t the use of CmdStan a hack necessitated by the 
> absence of a strong C++ FFI, which would allow us to interface directly with 
> Stan itself?
> 
>  — John
> 
> On Jul 9, 2014, at 8:43 AM, Rob J. Goedman <[email protected]> wrote:
> 
>> Viral,
>> 
>> Didn't know about the 'shared grant proposal', certainly a tasty bit of info 
>> that should not get lost! 
>> 
>> John,
>> 
>> Both Ben (Goodrich) and Bob (Carpenter) of the Stan team pointed me to 
>> another Julia package:
>> 
>> https://github.com/brian-j-smith/Mamba.jl
>> 
>> Brian has contributed and maintained the boa package for R. Mamba looks 
>> very, very promising. With little red ears I'm studying the package.
>> 
>> It was also pointed out to me I'd forgotten to mention that Stan.jl requires 
>> Julia's v0.3-prerelease (as it uses the new DataFrames).
>> 
>> Finally, a significant part of the value of CmdStan/Stan is the Stan team & 
>> community. Even with a mature C++ FFI, I would like to remain as 
>> 'interchangeable' with both Stan and CmdStan as possible.
>> 
>> Rob J. Goedman
>> [email protected]
>> 
>> 
>> 
>> On Jul 7, 2014, at 4:54 PM, John Myles White <[email protected]> 
>> wrote:
>> 
>>> This is really nice to have. I'll definitely be using it for some of my 
>>> work.
>>> 
>>> Now that Keno's been working on a C++ FFI, we might even be able to avoid 
>>> using CmdStan.
>>> 
>>>  -- John
>>> 
>>> On Jul 7, 2014, at 4:40 PM, Viral Shah <[email protected]> wrote:
>>> 
>>>> It is great to have a Stan interface. I personally do not do MCMC stuff, 
>>>> but there are mailing list threads discussing it. Julia and Stan also 
>>>> shared a grant proposal at one point - so now this makes everything come a 
>>>> full circle!
>>>> 
>>>> -viral
>>>> 
>>>> On Monday, July 7, 2014 3:28:17 PM UTC-7, Rob J Goedman wrote:
>>>> A while ago above question came up on the Julia MCMC issue list ( 
>>>> https://github.com/JuliaStats/MCMC.jl/issues/45 ). 
>>>> 
>>>> I have no idea how much interest there is in such an interface, but I 
>>>> wanted it at least for my own use, in addition to a similar interface to 
>>>> Jags (which I'm working on), and of course Julia's own MCMC.jl is readily 
>>>> available from METADATA.
>>>> 
>>>> Stan.jl is an initial version of such an interface. It is assumed users 
>>>> have some experience with Julia (REPL, iJulia, LightTable, etc.) and some 
>>>> familiarity with Stan script and data files.
>>>> 
>>>> To test it, three steps are needed:
>>>> 
>>>> 1. Install CmdStan as described in the Getting Started sections 2.2, 2.3 
>>>> (and 2.4 to test it) of the CmdStan Interface User's Guide (Version 2.3.0, 
>>>> Jun 20th, 2014).
>>>> 
>>>> 2. Set the environment variable STAN_HOME to point to the directory where 
>>>> CmdStan was downloaded, e.g. on OSX I added to my .bash_profile:
>>>> 
>>>>    export STAN_HOME=/Users/rob/Projects/Stan/cmdstan/
>>>>    launchctl setenv STAN_HOME /Users/rob/Projects/Stan/cmdstan/
>>>> 
>>>>    The launchctl line (on OSX) will typically only be needed for e.g. 
>>>> LightTable and similar apps that do not inherit the full shell environment.
>>>> 
>>>> 3. Install Stan.jl:
>>>> 
>>>>    Julia >  'Pkg.add("Stan")' .
>>>> 
>>>> To test the setup:
>>>> 
>>>>    Julia > Pkg.test("Stan")
>>>> 
>>>> The README.md file in the Stan.jl package contains a walk-through example, 
>>>> somewhat similar to section 2.4 of the CmdStan Interface User's Guide.
>>>> 
>>>> This is a first version of Stan.jl and no doubt will need tweaking (and 
>>>> more!). I can't test on non-OSX platforms either, so I will need help to 
>>>> iron out issues on those platforms.
>>>> 
>>>> Dependent on the level of interest and feedback ( please file 
>>>> requests/issues at https://github.com/goedman/Stan.jl/issues ), additional 
>>>> features will be added as time permits or through 'Pull Requests'. 
>>>> 
>>>> R and Python are in a very different stage of their life cycle compared to 
>>>> Julia and Stan, so I have opted to keep the package lightweight to track 
>>>> changes in both Julia and Stan. 
>>>> 
>>>> The two primary features currently implemented are generating a Model() to 
>>>> be used to automatically generate the command to execute a Stan script and 
>>>> the use of make to minimize the number of compilations required.
>>>> 
>>>> This Stan.jl version cannot activate sub-parts of Stan, like R can through 
>>>> Rcpp. By default Stan.jl runs 4 chains when sampling.
>>>> 
>>>> Regards,
>>>> Rob J. Goedman
>>>> [email protected]
>>>> 
>>> 
>> 
> 

Reply via email to