ScalaStan Without R Input Or Sample Files?

Operating System: MacOS 10.13.6
Interface Version: ScalaStan 0.5.11
Compiler/Toolkit:

@joewing

We would like to use Stan with a large-scale Java project so the obvious choice is the ScalaStan interface. While this works nicely, I noticed some things that are less than ideal in a server setting.

The first thing is an artifact of ScalaStan being an interface to CommandStan’s generated model executable, that is, it will create and use R data files and Sample output CSV files.

The second thing is that when running ScalaStan (i.e. model.compile.withData().run()) with the same seed in multiple threads, errors start to pop up. I suspect this might be an issue because the seed value is part of the sample output file name, but I don’t know for sure.

Ideally we would like all the benefits ScalaStan brings without it writing and reading from files. I suspect the only current way to not use R or Sample.csv files would be to use the stanc C++ output directly (with a JNI interface). Is that correct?

You are going to want to tag someone like @joewing on ScalaStan questions

I believe you are correct that we would need to go the JNI route to avoid reading/writing files. I haven’t looked into it in detail primarily because the command Stan interface is easy to use and has worked for us. To avoid the compile step completely, it seems to me we would have to have bindings to everything stanc emits. Maybe there’s an easier way, I don’t know.

As far as the errors with multiple threads, that should be an easy fix.

I’ll open issues for both of these things.
Thanks for letting me know!

Thanks!