10

Why is every fucking machine learning tutorial made with fucking python code

Comments
  • 1
    I feel you.
    I hate python.
    I tried ML in Java but it kinda fried my brain.
  • 7
    Because script kiddies.

    But seriously it's just a better interface. Code is readable in the most part and you don't need number crunching performance to call a library which is already optimized AF
  • 5
    Because it's often used to teach people the basics of programming.
  • 4
    > I hate python

    😢
  • 3
    @iiii reasonable. I've been trying to get over my anti-pythonism lately. But man the non c-like syntax hurts my eyes :"
  • 1
    @MohammedC try Perl. Python's syntax will look like a prose in a book.
  • 2
    Because the Google brain (TF) and MXNet teams picked it, and that forms the vast majority ML applications out there.

    As for why they picked it - I can only guess, but I wouldn't be surprised if it's because it's one of the very few popular, general purpose modern languages to support sane large numbers, and complex numbers.

    Being able to raise numbers to large powers without ever really worrying about overflow or types is really a nice thing not to worry about. And in the complex domain, being able to write `5+7i` rather than `Complex.of(5, 7)` or similar makes code *way* more readable and easy to understand.

    I'm no fan of Python in general, but this is one area where I wish other langs would catch up.
  • 0
    @AlmondSauce to be fair, I really doubt the TF library itself has much python code, so the point about numbers in python is probably wrong. I'd bet it is a very performance optimised C++ underneath or something like that.
  • 1
    @iiii Yeah, that's very true. I guess it's literally just because a lot of data scientists used it already, in that case. (Though I guess the reasons I've given above are part of the reason why they were using it already.)
  • 2
    ML researches seem to love that language, I couldn't despise it more

    I guess you can do tensorflow with JavaScript, but that seems just as unnecessary

    Other options would probably be Java or C#, but I haven't messed with ML in those languages at all
  • 0
    @AkshayTolwani auto is your friend.
  • 0
    @AkshayTolwani it does, but it deduces what it is so you don't need to change its type constantly.
  • 1
    @Jilano Python is definitely not a language for "beginners" or "people that are just starting out", it's just a good fit for tutorials, etc... Since it has a simple syntax and is quick to write no need for BS boilerplate code. This makes it a really powerful language where you can write good code faster than most languages. Ex. if you want to get the last item of a list there is no need to do length - 1 you just do: "my_list[-1]" tell me that's not waay better. Simple does not mean basic!
  • 0
    @pythondev Never said it was, just that it's often used as such (which might be a mistake).
  • 0
    @Jilano which language in your opinion is the best for teaching? (Plz, don't say JavaScript)
  • 0
    @iiii Hard to say because it depends on many variables (e.g. if your students have a technical/IT background or not). If you don't want to go the Python road for any reason, I'd say Java is a good start.
  • 0
    @Jilano why Java though? Doesn't it impose object oriented design on the user?
  • 1
    @iiii Why would that be a bad thing?
    Python also supports object oriented programming, but you don’t have to use it unless you want to, just as in Java.
  • 1
    @Python because it might frame individual to only use object oriented design which it's not always a good idea.
    Basically, it imposes too much of its own design on the user.
  • 1
    @iiii I really don’t buy in to that argument, but that’s for another time.

    But again, just because the language supports OOP you doesn’t mean you have to use it if you don’t want to.
  • 0
    Just for reference, my first language was C# in college and we never touched any OOP design patterns in the first year.
  • 2
    @iiii I agree with @Python

    Besides, if a student is not curious enough to read about other languages by himself and how they work, you can't do much about that.
  • 0
    @Jilano okay, but why is Java your choice in the first place?
Add Comment