My last job was at an ML company. Most ML people there cannot build large robust systems and some struggled with the non-algorithmic bits of software. I am sure that some can out there in the world, but for the most part our ML people were very good at creating models and not very good at the development part, especially as the program grew (part of the motivation to hire devs like me in the first place). Python gets…
Ask HN: How did Python become the lingua franca of ML/AI?
81–90 of 99 posts
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#82My last job was at an ML company. Most ML people there cannot build large robust systems and some struggled with the non-algorithmic bits of software. I am sure that some can out there in the world, but for the most part our ML people were very good at creating models and not very good at the development part, especially as the program grew (part of the motivation to hire devs like me in the first place). Python gets…
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#83Python's a lingua franca in AI/NN because it was already a dominant language in scientific computing. Its dominance in scientific computing grew steadily through the 1990s and 2000s, for a few reasons: 1) Python -- specifically CPython -- made it easy to wrap existing, thoroughly tested high performance libraries in Python APIs. So, you got easy access to things like GSL and BLAS and LAPACK, but you get to call numpy…
Extending the comment a little: I'm crediting CPython for the nice APIs, but really I should be crediting David Beazley's SWIG. That got the ball rolling on a lot of projects.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#84NumPy, SciPy and the ecosystem around them. So much of what you do in ML involves matrix operations. People used to do this stuff in Matlab. Matlab is good at numerics but it's not a very good programming language, and doesn't have very good libraries outside of the numeric domain. The open source nature of NumPy and Python encouraged a big open source community that is hard to get going if you're building open sourc…
But. It's commercial. And thus prohibitive to the hobbyists and enthusiasts who are ultimately reaponsible for this kind of network effect.
And while I have a lot of love for octave, without the slew of proprietary packages and functionality available to matlab, it is hard for it to compete in such an ecosystem, despite some nice courses out there that use it (notably Andrew Ng's ML course).
If more people contributed open source packages to octave I'm sure it would become as big a player as python.
(inb4 julia: yes, but julia has other problems)
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#85Earlier quoted context omitted.
Monkey patching is a terrible practice outside of unit testing and can lead to extremely difficult to debug bugs. Also monkey patching isn't unique to python.
FWIW I tried looking a few up and standard library seemed hit-or-miss: JavaScript it didn't work: class testClass { constructor() { } callHoHe() { console.log('ho', 'he'); } } let hi = new testClass(); hi.callHoHe(); testClass.callHoHe = () => { console.log('haha'); } let heh = new testClass(); heh.callHoHe(); This ended up just printing 'ho', 'he' twice, For Java people didn't think it was possible: https://stackove…
The better solution is to encapsulate the class and override the methods. Monkey patching is terrible because the behavior of the function is changing at run time. If someone is not aware that you are monkey patching a function the only way for them to determine what is going on is to step through the code with a debugger.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#86Because Python has NumPy, which implements vectorized math on arrays and matrices. Machine learning algorithms are implemented naturally and efficiently with those primitives. PyTorch, TensorFlow, and I think every other machine learning framework in Python all use NumPy. JavaScript, Ruby, and Perl either don't have this abstraction at all, or they have much weaker versions of it, and many fewer scientific libraries.…
I don't know that Numo for Ruby is “much weaker” than NumPy. It looks like installation is rougher since it doesn't bundle dependencies, and its newer and thus there is less downstream ecosystem.
> JavaScript doesn't have operator overloading; I'm pretty sure Perl doesn't, but not sure about Ruby
Ruby and Perl both have operator overloading. (Perl has “use overload”, and in Ruby operators are defined via overridable methods.)
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#87ML / AI were derived from Data Science. So hence it was built up upon the same python foundation.
As to why Python on Data Science. One needs to be reminded most people doing Data Science, or any Matlab type of work do not considered themselves as programmers. They dont want to learn about 20 reason why functional programming, or objected oriented programming are better and 100s other best practice with 1000 tricks to write the same program.
Although I do wonder if Julia may have a chance to dethrone it in the next 10 years.
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#88NumPy, SciPy and the ecosystem around them. So much of what you do in ML involves matrix operations. People used to do this stuff in Matlab. Matlab is good at numerics but it's not a very good programming language, and doesn't have very good libraries outside of the numeric domain. The open source nature of NumPy and Python encouraged a big open source community that is hard to get going if you're building open sourc…
Matlab is an excellent language. With great packages, C/C++ interoperability, seamless GPU support, and JIT compilation. Arguably it w is easiet than python for this purpose. But. It's commercial. And thus prohibitive to the hobbyists and enthusiasts who are ultimately reaponsible for this kind of network effect. And while I have a lot of love for octave, without the slew of proprietary packages and functionality ava…
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#89Because Python has NumPy, which implements vectorized math on arrays and matrices. Machine learning algorithms are implemented naturally and efficiently with those primitives. PyTorch, TensorFlow, and I think every other machine learning framework in Python all use NumPy. JavaScript, Ruby, and Perl either don't have this abstraction at all, or they have much weaker versions of it, and many fewer scientific libraries.…
Ruby does have operator overloading. And it is kind of sad to me that Python is so much more popular than it, even though Ruby has a much cleaner object-oriented foundation. Not to speak of underscores...
This kind of code is naturally expressed in "functions and data" rather than "objects" (data being vectors, matrices, etc.).
And I say this as someone who uses objects in most of my code! (which is not scientific code)
Re: Ask HN: How did Python become the lingua franca of ML/AI?
#90NumPy, SciPy and the ecosystem around them. So much of what you do in ML involves matrix operations. People used to do this stuff in Matlab. Matlab is good at numerics but it's not a very good programming language, and doesn't have very good libraries outside of the numeric domain. The open source nature of NumPy and Python encouraged a big open source community that is hard to get going if you're building open sourc…
Matlab is an excellent language. With great packages, C/C++ interoperability, seamless GPU support, and JIT compilation. Arguably it w is easiet than python for this purpose. But. It's commercial. And thus prohibitive to the hobbyists and enthusiasts who are ultimately reaponsible for this kind of network effect. And while I have a lot of love for octave, without the slew of proprietary packages and functionality ava…
That's pretty much the alpha and omega. MATLAB had a 20 year head start on everybody and wasted it because everybody hated MathWorks so badly.