Well, I just wrote a scala.js react component today where i need to upload a picture to a server view a HTTP request encoded as base64, so if I can do that … then I can read in the data by selecting actively what it is ?
Or what kind of interface do you want to transfer the data over ? OS to Browser ? or Browser to Compiled stan.js / stan.wasm ? In the second case, since the compilation takes place in the browser, and the browser can remember the selected data file, and it’s contents. Which can be placed somewhere … such that the stanc.js / stanc.wasm has access to it while it is generating the C++ code from the Stan code (which - in my app - of course - will be generated by Scala code … LOL - just to use the most sophisticated language on the planet, which generates maybe one percent of the world’s GDP ( A very optimistic thought - OTOH - python won’t cut it in the cloud… even DrobBox is going bankrupt because of python… imperative languages are not compositional and that is a huge problem… if you have a choice… where you can suddenly reimplement Stan in pure scala in two years by a small FP community … https://github.com/stripe/rainier in a way that it won’t be difficult to massively parrelellize it since the computations are also composable, first class citzens that can travel along the streams - like in this blog https://darrenjw.wordpress.com/2017/04/01/mcmc-as-a-stream/ )
I cannot tell if I am delusional or not, but if there is a 10 times better technology for certain tasks then that will overtake the current ones … and once it comes to async computations, atm, Scala is the only choice… hence Spark and it’s friends are now written in Scala … and if you want to cut costs on composing programs, then you better have a sophisticated type system, so, again, python, R can be thrown out of the window.
The Stan community is much more active than the Rainier but technology wise (https://darrenjw.wordpress.com/2018/06/01/monadic-probabilistic-programming-in-scala-with-rainier/) , sooner or later, FP (and all the good things that come with it) will win, for many reasons, that maybe you already all know.
So, food for thought… maybe it is time to start to think about ditching C++ and replacing it with Scala (that is the most widely adopted FP language). There is also Haskell and ML but… and Idris… but it seems that the ML/AI world, especially big data / cloud world likes to use Spark a lot, which is written in Scala, and they are just starting to scratch the surface of the story here…
Just have a look at Rainier and I would not be surprised if you would start to seriously think about switching to Scala, just look at the code that does the symbolic differentation : https://github.com/stripe/rainier/blob/develop/rainier-core/src/main/scala/com/stripe/rainier/compute/Gradient.scala
I am not a super good FP coder, but the ones who are can re-implement Stan using FP from scratch in a few months, I mean, what do you need ? A symbolic differntiation and RX ( http://reactivex.io/ ).
Because the problem with C++ is that it is not functional and not compositional, and it does not take you 2 minutes to write a Monad out of the blue that solves some particular problem, because 1) the language does not support it, 2) the libraries do not support it, 3) the books from which you learn how to solve problems do not support it.
The problem is that you want the Bayesian “science” and “research” to continue to grow and evolve, but I am not sure that in the age of distributed computing a language that was designed for Von Neumann architectures will be competitive - and it’s better to realize it now, than ten years from now… all these things I am talking about are already generating/saving lot of Gs… I think it might be worth for science to catch up too.
To the best of my understanding, ScalaStan was originally created because compositional (and “DRY” and Statiacally typed) Bayesian modelling was very useful (or say, even a must - in my subjective understanding) for the author. I can totally resonate with that.
C++ was the only choice 15 years ago, but it will not be an option 10 years from now, the latest. Maybe it’s time to use a programming language that is 10 times more efficient for these kind of problems already today, why ? Because they do exist and are used to make lot of money (distributed computing / compositional modelling).
What I am saying here goes well beyond Stan, I think it will effect the whole AI story… deep learning and way beyond … data and algorithm streams are all over the place … Von Neumann architecture is not cutting it anymore, it was never meant to cut it. No wonder the brain is the opposite of the Von Neumann architecture, if you want to simulate the brain on a Von Neumann machine then you better build a nuclear power plant first for it, not just plant a few apple trees.
Ok, bottom line, reactive streams, monads, interpreters, abstract syntax trees are on its way and are already havily used in industry for years…
I think, that I am not saying anything new to anyone here, because I am not such great expert in ML, but for me, this is a new idea. The idea, that the change has already started and most importantly it won’t stop, IMHO. But after thinking about this, it is actually trivially true, but before… it was not. Just like with the transistor… a simple thing, but somebody had to invent it :).
So, my answer, to how to make Stan “go faster” is to throw out the C++ implementation and reimplement the know-how in Scala using a totally different, future proof architecture, based on FP principles, and on “all the good stuff”, you know all of it… I am pretty sure, this is nothing new, I am no big expert here, I know that, but I was a bit shocked by the revelation that this thing is happening much much faster than I envisioned.
Let’s take the brilliant ideas from Stan and transplant them into future technologies - otherwise somebody else has to reinvent the wheel and put the wheel into future technologies, and those wheels will be really creappy wheels, behind shiny new technologies, and that will be a sad story to cry about to your psychiatrist robot 20 years from now.
LOL :)
J.
OVER AND OUT for a few days.