Everyday when searching the internet, I find a new Machine learning course with Python or R. I know that Python has a huge number of libraries which facilitate the job. However, JavaScript has a big community and there are so many npm modules to use and resolve different problems. Why JavaScript is not well known with ML?
Another reason is performances. Computing intensives operations in Python and R are coded in raw C (and embedding custom C code in Python or R packages/libs is much more common practice than with js)
Because of these long standing roots and the ease of adding performance-critical parts, those languages have been home for ML frameworks for years (long before ML become the crazy trend we know these last years). And developing, and optimizing, frameworks with ML algorithms requires a lot of work - hence a lot of time.
Python is simple, consistent, elegant, and math-like.
The code has been said as readable pseudocode. Python is one of the most flexible languages and it can be used for numerous purposes. Python contains special libraries for machine learning namely NumPy and SciPy. These are great for linear algebra and getting to know kernel methods of machine learning. Python is acting as a huge help when working with machine learning algorithms and has relatively easy syntax.
In a nutshell, Python’s popularity for Machine Learning is mostly an example of historical emergency or using more colloquial phrase, “The rich get richer”.
JavaScript is single threaded and cannot offer the top notch performance compared with other programming languages, even with many tweaks developers have improved JS with like "Async" which is used to mimic the process of creating a new thread, though it is not in reality.
I'm not sure about python as I haven't used it much though.
Momentum is one reason. As others have mentioned Python is widely used by mathematicians, scientists, and data scientists. Many of the popular libraries for data science and ML, like Pandas, Juptyer Notebooks, Keras, TensorFlow, are written in Python.
JavaScript is not as well suited for ML work. Its math libraries are not as mature. It does not have native support for large numbers. And while Node has great performance for IO intensive tasks, its performance is much weaker for CPU intensive tasks.
However... this may not be the case for long. Native support for big integers is a proposal in TC39. Google announced this year a JavaScript library for TensorFlow that runs in browser and utilizes WebGL for hardware acceleration. ML in the browser has some very compelling advantages over ML in Python. They have also announced that they will soon release C bindings for Node that will enable ML tasks written in JavaScript to run directly on a GPU or TPU. Support for JavaScript in Juptyer Notebooks has also been advancing. It may not be long before JavaScript is as ubiquitous in ML as Python.
Time in market.
Whilst JavaScript has been around since the late 1990's it has traditionally only existed in the browser; and the performance was nonexistent. It wasn't until Google created their V8 JavaScript engine and someone went "let's make a standalone" -- aka node.js -- that it was even practical to use as a general computing language. There are STILL developers who don't even realize you can use JavaScript server side, and an equal number who STILL scoff at the mere notion since prior to node.js it was one of the slowest hardest to use inefficient languages available.
Basically, node.js came out in 2009, it took nearly five years for it to gain any real foothold with developers, and prior to that NOBODY looked at JavaScript as anything more than a browser based novelty. It is STILL considered by many a rinky tinkertoy. Though that reputation is undeserved, the stigma of its past persists!
Python came out in 1991. It has for all intents and purposes a five year head start on EXISTING as a programming language, and a 18 year head start on being used as a general purpose computing language you can run directly on a system without a browser.
It's hard to overcome that type of traction.
Historically, Python always had an amazing Math/Scientific computing package/libraries, and many of the python syntax (e.g. list comprehensions) reads like typical mathematical formulas, and python can handle big numbers natively. So it is often the preferred language for Mathematicians (when they want move beyond Matlab or R). And a lot of machine learning is basically Math. So a lot of researchers (who usually have stronger math background) uses Python to experiment with ML algorithms, and sometimes creating the initial libraries in ML. (although after algorithms are proven to work, the algorithm often are rewritten in more efficient languages like C++, but they still often kept the Python interfaces).
For comparison, for history of Javascript, it is originally intended as a quick and simple script thing for running inside browsers to manuplate the DOM, and only in 2009, with NodeJS, people started to use it for backend.
Javascript =/= good at maths.
Python and (especially) R already had a lot of packages before Javascript came to the server. So for a large part its momentum. I don't suspect there is much overlap between web developers and machine learning researchers, so they start from scratch, and obviously pick the dominant one.
But to ask the reverse: why would JS be big with machine learning and data science?
The advantage of Javascript is availability in the browser (and so people who like to write a single language use it on the server), and it has event stuff built in. Not really helpful for ML.
But even beyond that, it's a much less consistent language than Python with many weird quirks, it has no relevant ecosystem (except maybe charting), even numjs is new and nowhere near numpy.
I suspect that since ML is performance-sensitive, if it does come to the browser now, it's going to be mostly WebAssembly.
Matt Strom
Software Engineer, TypeScript ninja
Jason Knight
The less code you use, the less there is to break
webdevinci
I was lucky enough to join this session (TensorFlowJS) at Google IO a few days ago. You will see a big jump here soon with their adaptations: youtube.com/watch