Why are most machine learning models (not frameworks) written in Python? Even through almost any programming language can be used for machine learning?

  • tal@lemmy.today
    link
    fedilink
    English
    arrow-up
    10
    ·
    edit-2
    19 hours ago

    My impression from what code I’ve looked at is that little computation is done by the Python code itself, so there’s little by way of gains to be had by trying to use something higher-performance, which eliminates a lot of the reason one would use some other languages.

    Python’s cross-platform, albeit with a Unix heritage, so it doesn’t create barriers there. It’s already widely-used, a mature language that isn’t going anywhere and with a lot of people who know it.

    It’s got an ecosystem for distributing libraries over the network, and there’s a lot of new code going out and being distributed rapidly.

    Python isn’t statically-typed. Static typing can help write more-robust code. If you’re writing, say, the next big webserver, I’d want to have that checking. But for code that may often be running internally in a research project — and this is an area with a lot of people doing research — a failure just isn’t that big a deal. So, again, some of the reasons that one might use another language aren’t there.

    And I imagine that there’s also inertia. Easier to default to use what others would use.

    If you have another language in mind, you might mention that, see if there might be more-specific things. I could come up with more meaty plausible guesses if what you were wondering is something like “why isn’t everyone using SmallTalk?” or something.

    • ryannathans@aussie.zone
      link
      fedilink
      arrow-up
      4
      ·
      15 hours ago

      YouTube does alright being written in python, and being strongly typed Python is leaps and bounds beyond the JavaScript that I am now seeing on the server side 🙃