ScalaStan works nicely out of the box ! Looks good!

I just gave a quick try to ScalaStan, and I was surprised that I managed to make it work withing 30 minutes.

Nice ! Recommended.

I plan to implement some educational Stan models, etc, on the server, in Scala, and connect it to the client using irie (my hobby project). This is a slow burning project, but it’s a nice progress that I can use Scala for Bayesian inference, coupled it with Spark, Breeze and all the Scala goodies. This could be a pretty nice pure Scala ML Stack. There is also rainier, might be worth looking into some point.

Baby steps… slow burning project. But I have some ideas for some educational web apps.

http://github.com/jhegedus42/irie/blob/master/modules/server/src/main/scala/learn/ml/stan/NaiveBayesExample.scala#L10-L10

I don’t know if it makes any sense or not, but if one creates the model in a compositional way, then maybe there are ways to “evolve it”.

Recently I got into functional reactive programming again and the graphs can be dynamic, changing over time, changing with “training”. The automatic differentation can travel also through the FRP / monix pipelines, so … I am really wondering if this is going to happen or already happening (maybe with rainier…). Not sure.

ScalaStan goes a bit into this direction. A bit. But it’s a start.

3 Likes

I tried it in jupyter lab, it works just as well. DECENT ! Very nice !

I also attached a PDF file from the notebook, it is very messy, but if you wanna try it yourself you find a lot of stuff in it… breeze, visualisation, rainier and whatnot…
and of course ScalaStan !

The notebook is messy… its all over the place… but it has everthing you need to do some ML with Scala. Including two HMC approaches.

JupyterLab.pdf (246.0 KB)

1 Like

I just noticed this … https://bigdl-project.github.io/master/#APIGuide/Data/#sample

I don’t know what is happening but apparently Scala is taking over the ML world.

It was of course inevitable that it will happen but soooooo soooooon ???

This thing is killing everthing out there in deep learning land… already today…

Scala core, python wrapper… works on 1000 something cores … out of the box… goodbye tenzorflow and the rest… this is written in 100% pure scala code, the core logic, and has some bindings to some legacy stuff…

omg… sure, it was bound to happen, BUT SOOO FAST ???

I remember one year ago asking people, why are you not using Scala for ML ? Because it is difficult to find Scala programmers… today the question looks like : why are you not using Python for ML ? Because it is difficult to find Python libraries that can handle more than 5 cores.

Aalto University was pretty clever when they started teaching Scala to 1st year CS students already some 8 years ago, as an intro course to programming.

Apparently they have also seen this coming, but soo fast ? That surprises me…

ScalaStan is pretty cool, no? here’s the talk from StanCon 2018 Asilomar:

ScalaStan and JuliaStan are the reason that we’re adopting the “lightweight wrapper” philosophy behind CmdStanPy and CmdStanR.

1 Like

Yeah, I don’t know what that really means, but I think it is a waste of time to try to keep up fighting superior future technologies with C++ and python and all those things… best is to ditch all those dead ends and rewrite Stan in Scala.

The problem is that Stan won’t stand a chance in the cloud agains the competitors which are now being written in Scala, say Rainier, and who else is also writing HMC on top of Spark and so on … all in Scala, pure, 100% Scala code…

I don’t want to explain why Scala is good, what surprises me is that people actually decided to use it because it is difficult to get good at it. But apparently money talks - and in the cloud ML world the companies who are trying to fight with swords against tanks will loose.

So, wrapper this, wrapper that, is a nice start, but won’t last long.

Rainier is just mind blowingly smartly written. Why ? Because the language is powerful and clever people can write super powerful stuff in it in no time.

I am no good programmer, but I see it. There are some clever people who can use Scala and create something in 2 years that would take 20 for a 20 man team. Like my friend, who recently made his first 1M$ coz he wrote a solid Scala web app (he is a pro - I were not able to write it). Anyway, what I say is, ditch C++, look at Rainier and take what you can, put all the cleverness and smartness into a nice piece of Scala code and that can be the future of Stan. Something that will work on 10000 cores.

Not C++ or python or whatever else… but most of you guys are CS people so I don’t have to explain this too much.

I am saying, ScalaStan is awesome but it is just a wrapper. Rainier is the same as Stan but 100% Scala, and if they want, they can push it to 10000 cores using monix in two days of coding.

Scala is powerful, and there is lot of money in big data + AI, and for that, Scala is the most economical technology to create software that works on top of spark, cloud, whatnot.

So… this is no big news. I am not going to bring this up again. It’s already almost too late. But just in case… if you guys want that Stan survives then it will need to be rewritten into Scala. I am getting tired of being a broken record and keep saying this.

BTW, I found this awesome stuff on deep learning:

In my opinion it really thightly connects to HMC (I came to similar
realisations from thermodynamical / statistical physical arguments).

So… deep learning might have to do quite a lot with HMC…

I won’t be surprised if the two will meet halfway.

Over and out.

Ditch C++ and reimplement Stan in Scala, otherwise it won’t have a future. Sad, but inevitable.