@sambodhi 2017-03-20T02:11:23.000000Z 字数 8027 阅读 1366

# The Most Popular Language For Machine Learning Is ...

【提要】
Jean-François Puget博士分享了他的观点，阐述了机器学习和数据科学中都流行哪些语言，并阐述了在机器学习和数据科学应该选择哪门语言的原则。

【正文】
Jean-François Puget博士居住在法国Saint Raphael，是IBM的杰出工程师，从事机器学习和优化。

Jean-François Puget博士写了一篇《机器学习最流行的语言是哪门？》文章，经作者授权，InfoQ翻译并分享。以下是正文。

What programming language should one learn to get a machine learning or data science job? That's the silver bullet question. It is debated in many forums. I could provide here my own answer to it and explain why, but I'd rather look at some data first. After all, this is what machine learners and data scientists should do: look at data, not opinions.

So, let's look at some data. I will use the trend search available on indeed.com. It looks for occurrences over time of selected terms in job offers. It gives an indication of what skills employers are seeking. Note however that it is not a poll on which skills are effectively in use. It is rather an advanced indicator of how skill popularity evolve (more formally, it is probably close to the first order derivative of popularity as the latter is the difference of hiring skills plus retraining skills minus retiring and leaving skills).

Enough speaking, let's get data. I searched for skills used in conjunction with "machine learning" and "data science", where skills are one of the prominent programming language Java, C, C++, and Javascript. I also included Python and R which we know are popular for machine learning and data science, as well as Scala given its link to Spark, and Julia that some think is the next big thing here. Running this query we get the data we are looking for:

When we focus on machine learning, we get similar data:

What can we derive from this data?
First of all, we see that one size does not fit all. A number of languages are fairly popular in this context.

Second, there is a sharp increase of popularity for all these, reflecting the increased interest in machine learning and data science over the last few years.

Third, Python is the clear leader, followed by Java, then R, then C++. Python lead over Java is increasing, while the lead of Java over R is decreasing. I must admit I have been surprised to see Java at the second place, I was expecting R instead.

Fourth, Scala growth is impressive. It was almost non existent 3 years ago, and is now in the same ballpark as more established languages. This is easier to spot when we switch to the relative view of the data on indeed.com:

Fifth, Julia popularity is not anywhere near the other, but there is definitely an uptick in the recent months. Will Julia turn in one of the popular languages for machine learning and data science? Future will tell.

If we ignore Scala and Julia in order to be able to zoom on the other languages growth, then we confirm that Python and R grow faster than general purpose languages.

It maybe that R popularity will pass that of Java soon given the difference in growth rate.When we focus on deep learning with this query, the data is quite different:

There, Python is still the leader, but C++ is now second, then Java, and C at fourth place. R is only at the fifth rank. There is clearly an emphasis on high performance computing languages here. Java is growing fast though. It could reach second place soon, as for machine learning in general. R isn't going to be near the top anytime soon. What surprises me is the the absence of Lua, although it is used in one of the major deep learning frameworks (Torch). Julia isn't present either.

The answer to the original question should now be clear. Python, Java, and R are most popular skills when it comes to machine learning and data science jobs. If you want to focus on deep learning rather than machine learning in general, then C++, and to some lesser extent C, are also worth considering. Remember however, that this is only one way of looking at the problem. You may get a different answer if you are looking for a job in academia, or if you just want to have fun learning about machine learning and data science during your spare time.

What about my personal answer? I answered earlier this year in this blog. Besides having support from many top machine learning frameworks, Python is good fit for me because I have a computer science background. I would also feel comfortable with C++ for developing new algorithms, given I've programmed in that language for most of my professional life. But this is me, and people with different background may feel better with another language. A statistician with limited programming skills will certainly prefer R. A strong Java developer can stay with his favorite language as there are significant open sources with Java api. And a case can certainly be made for any of the languages on these charts.

Therefore, my advice would be to read other blogs discussing the same question before investing significant time in learning a language.

minimaxir：
Everytime a "what's the best language for Machine Learning/Data Science?" thread pops up, it always devolves into a flame war between "real data analysts use R" and "Python has thousands more libraries!". (most recent example 16 days ago: https://news.ycombinator.com/item?id=13110230 )

My response is always use-the-most-appropriate-tool-for-the-job-dammit and don't pigeon-hole yourself into one language, since each language has their pros and cons. I am very tempted to write an HN autocomment bot at this point. (in Python instead of R, of course, since that's the most appropriate tool for this job)

minimaxir:

joshvm：
You can write and test classifiers in about 5 lines of Python using scikit-learn.

The other advantage of Python is that as a scripting language it's very powerful for data wrangling and pre-processing, without needing all the boilerplate that e.g. C++ would require.

joshvm：

Python的另一个优点是，它作为脚本语言，有非常强大的数据整理（ data wrangling）和数据预处理（ data pre-processing），而不需要所有的样板文件（ C++就需要）。

stevehiehn：
After a year of experiments i realized that machine learning and big data pipelines are inseparable.So at first i was thinking R/Python is the greatest.And it might be until you need to do more that a few isolated models. At that point i reverted to building the pipeline parts with Spring Java + InMemory DataGrids because there is so many options.

stevehiehn：

vonnik：
Torch is a great library, and Lua a fine language, but they are competing against ecosystems built on the world's largest languages.

vonnik：

Torch是一个很了不起的库，Lua是一门精致的语言，但它们正与建立在世界上最大语言之上的生态系统竞争。

jhartmann：
I use a tiny bit of python, a little more LUA, and a TON of C++ in the machine learning work I do. Things like opencv, fbthrift, folly, boost, fblualib, and thpp make writing this sort of code in C++ very time efficient and if you know what you are doing it will end up performing much better than the alternatives. I only use python for some light scripting, data collating and reformatting type tasks, and LUA due to using Torch as my Neural network framework of choice.

jhartmann：

• 私有
• 公开
• 删除