# What programming language do you recommend to prototype a machine learning problem?

Currently working in Octave, but due to the poor documentation progress is very slow.

What language is easy to learn and use, and well documented to solve machine learning problems? I am looking to prototype on a small dataset (thousands of examples), so speed is not important.

EDIT: I am developing a recommendation engine. So, I am interested in using Regularized Linear Regression, Neural Nets, SVN or Collaborative Filtering.

• I once started with Octave, too, since my prof was into matlab (uuh this was fun during the coursework using the prof's library, since matlab and octave has not exactly the same syntax), but then I switched to R and was simply blown away by it's superior documentation and variety of libraries. – steffen Dec 16 '11 at 7:01
• Python is of course very easy to learn and to read, so I guess it is a matter of taste. I suggest these links: python-stat-workbench, what-programming-language-for-statistical-inference, machine-learning-using-python, clojure – steffen Dec 16 '11 at 7:07
• I'd recommend R, Python, or Matlab. For reasons too extensive to address, I'd drop Matlab. For a stats person, I'd go with R, for a programmer, I'd go with Python. For the inner loops, I'd go with C/C++. At sufficient scale, Matlab's costs exceed any benefits. – Iterator Feb 19 '12 at 12:21
• or, have a look at julia ... – kjetil b halvorsen Feb 19 '16 at 13:22

If you want to use something out of box, Weka could be a great starting point. There is no need to program anything. You import your data, visualize it and play around with different models.

Next up in chain would be R. There is some learning curve associated - especially with munging your data to fit into R data structures but once you get over that, you have tons of libraries which offer all the machine learning capabilities without much effort.

Next up would be hand programming the machine learning algorithms. Since you are already using Octave and looking for alternatives, maybe what you want is not to hand code algorithms in some other system but to just use the libraries written by other people.

If you go down the R path, you might find book by Luis Torgo (Data Mining with R: Learning with Case Studies) very useful (disclosure: no affiliation). It describes in depth case studies which you can adapt to your problem.

You might get better answers if you specify the specific algorithms you're interested in. I use R for this sort of thing (I do time series econometrics, though, not machine learning); you can see the existing functionality here:

http://cran.r-project.org/web/views/MachineLearning.html

and there is R code to implement the analysis in Hastie, Tibshirani and Friedman's Elements of statistical learning:

http://www-stat.stanford.edu/~tibs/ElemStatLearn/

R's packaging system is pretty great and nudges people towards documenting their code, and it's open source so you can always go look at the implementation. I haven't used Matlab in a few years and didn't use it for much machine learning -- their toolboxes are usually well documented but can be pricey, but user-contributed code is going to be as poorly documented as any other.

In his machine learning online course, Andrew Ng suggests using Octave/Matlab.

I recommend you enroll in the next edition of this course: it is really useful and you will learn many things about Octave and about the different machine learning algorithms.

EDIT 1: I agree with other people who prefer to work in R. However, in solving the problems of machine learning, most of your calculations will be in matrix form, and as pointed out by @Wayne, Matlab or Octave languages are very popular because of their power. You may want to have a look at the solutions to machine learning course exercises proposed by other students; surely you can learn some things from them:

Gkokaisel Github

Merwan Github

• I am enrolled in this edition of the course! The problem is that doing the simplest things outside of the course don't work! Documentation is useless. – B Seven Dec 16 '11 at 19:43
• I have to say that Matlab (thus Octave) is a terrible programming language. It's very popular in the engineering and machine learning fields, but that's due to its power, and being used in schools, not because it's a modern programming language. That said, you'll be more likely to encounter machine learning texts that use it than you will that use R or Python. – Wayne Dec 16 '11 at 21:05
• I do all my work in MATLAB, it isn't the best programming language in the world (I'd say R was even worse ;o), but it is worth persevering with as it is very good for machine learning research. For neural networks, look for the NETLAB library, and also investigate Gaussian Process with the GPML library, both are excellent bits of kit, and IIRC both work with octave. For regularised linear regression, it is only one line of MATLAB, for non-linear models, there is the GKM toolbox, theoval.cmp.uea.ac.uk/projects/gkm (sorry no mnual yet). – Dikran Marsupial Dec 18 '11 at 12:34
• Matrix calculations can be done in R as well, although the notation, e.g., t(A) %*% B, is less intuitive than in Matlab. – Itamar Dec 19 '11 at 19:43
• Aren't there good matrix libraries for every high level language like C#, Java, Python and Perl? – B Seven Dec 27 '11 at 17:51

The scikit-learn (now sklearn) should meet several of the criteria you described (speed, well-designed classes for handling data, models, and results), including targeted applications (L1/L2 penalized regression, SVM, etc.). It comes with a rich documentation set and a lot of examples. See also its description in a paper published in the JMLR.

An alternative framework in Python is Orange, which can be used through a gentle GUI or on the command line directly. For collaborative filtering, pyrsvd might be interesting but I've never tried it. However, Apache Mahout might certainly be used for collaborative filtering.

If you refer to an industrial prototype (i.e. something that is done to be used by real people and not for pure research) python is at the moment the only way to go.

If you use Matlab, Octave or R you get an easy to use environment for ML research but it will be a nightmare to put the model at work with an user interface or with a web service.

In python we are lucky to have both an extensive scientific ecosystem (sklearn for ML, pandas for data wragling, matplotlib/seaborn for visualization) and an application ecosystem (think about django and its rest framework).

Python it's an easy language to learn. In the future I hope the Javascript ecosystem will become scientifically sound as the python one, but despite some great projects I don't see that coming soon.

Don't wrap yourself in a box, use a general language!