

Machine learning algorithm benchmarked in Matlab, R and Scala - donretag
http://blog.brusic.com/2011/08/machine-learning-ex2-benchmarks.html

======
bufo
As it says in the post, this is just the benchmark of a for loop, and the
author rightly says that nothing can be inferred from it.

When it comes to prototyping, using languages such as scala brings nothing for
such type of mathematical algorithms as it is basically only loops and double
operations. You are better off with languages such as R/scipy where most of
the core is written in C/C++ and handily wrapped (there are many heavily
optimized packages in R to do gradient descent).

For production code, well, you know the correct solution ;)

------
joelthelion
None of this is as fast or efficient as implementing most of the stuff in
python/scipy and reimplementing the occasional hot spot in C++ :)

~~~
lliiffee
I've found Matlab to consistently outperform numpy (the gap growing in
recently releases adding multithreading supprt to Matlab), and the C++
interface is pretty much equally convenient. (Weave is awesome for python, but
only really usable in small toy problems.)

------
jgorham
I wonder if in his installation of R he has ATLAS build in as the linear
algebra workhorse. That seems to be optimized for something like this- I
wonder how this would affect R's speed.

------
ibgeek
This post compares Octave, not MATLAB. Similar languages, but completely
different implementations. I'd bet that if it were tested in MATLAB, it'd be
much faster.

~~~
brusic
Just joined hacker news in order to comment.

You are correct, the MATLAB code was tested in Octave. I would not have worded
the title HN is such a way. The goal is to learn the algorithms involved, not
trying to come up with the fastest version possible. The interesting part is
actually the performance of the JVM, not the comparison between languages.

------
MrMan
Good luck spending thousands of man-years reimplementing all of statistics and
numeric computing in Scala.

~~~
cema
But how about reimplementing R in Scala? Or, better yet, in Clojure? The best
of both worlds.

~~~
icey
I'm sure you're already aware of this, but just in case:

<http://incanter.org/>

~~~
cema
Indeed, Incanter is a famous project and for a while was one of the best
showcases for Clojure.

What it does is it implements some of the functionality of R in Clojure. What
I am talking about is instead compiling R to Clojure (or Java runtime; there
are portions of R projects implemented in C which may not map to Clojure
efficiently). This way, the R community does not lose the extensive library of
projects it has been producing for years.

