I’ve used both JS and Python extensively for like a decade (and TS for a couple of years). I think they all very effective languages.
For deep learning there all the usual benefits of using JS, e.g.:
easy to learn
huge community
flexible about paradigms
write code once, run anywhere (especially useful for training/deploying models as well as cool applications like federated learning on client devices).
I’m not really convinced JS has any useful benefit over Python in these areas except for running in the browser. I think Python runs everywhere else JS would run. I don’t think running in the browser has enough benefit to enough projects to overcome the already-built institutional knowledge around Python deep learning. Institutional knowledge is very important.
I know Python3 has type hints, but it’s a really horrible experience compared to any proper typed language.
I do not find this to be the case. Note that I’m not saying that Python typing is as effective as, say TS or C#, or many other languages with typing “built-in”, I’m just saying I don’t find it to be a horrible experience.
Both languages it’s hard to get a consistent experience with libraries that don’t properly implement types. On one hand DefinitelyTyped provides a larger variety of types for third party libraries than does TypeShed. On the other hand, IME, a good IDE is much more able to infer type information with your typical Python library than it is with your typical JS library.
That being said, I just don’t think many people doing deep learning stuff are doing any sort of type checking anyway.
I think if types are very important to you, depending on what about types you’re looking for, you’re much more likely to move to Java or C++ or Julia or something.
But with VSCode plugins, I just hover over a variable and it tells me what I’m doing wrong immediately.
I use PyCharm, not VSCode, but it gives you a lot of that sort of thing with Python code because of it’s native support for typing and type inference. However, this isn’t a very useful comparison point without a much more detailed comparison of what each offers.
In general, I think the real answer to your question is that JS isn’t obviously better or obviously better enough and thus there’s just no push to move to JS.
I’m very open to hearing about setups that work. When I had a look there didn’t seem to be a canonical way to do it and the one or two things I tried didn’t go well.
I just don’t think many people doing deep learning stuff are doing any sort of type checking anyway.
This is definitely my impression, but it seems weird to me. As a newbie to deep learning I’m constantly unsure what rank my tensors are and working with TS has meant I don’t have to constantly break my chain of thought to read code and work it out.
there’s just no push to move to JS
Yeah, this is basically what I’m confused about. In other areas I see a million JS fans piling in proclaiming the benefits even when it makes no sense, but that just doesn’t seem to happen with ML. Maybe the answer’s just that I haven’t got the right Python setup.
I could probably help you with specific problems, but my advice is mostly going to just be “use PyCharm”.
Like I said, it’s not perfect, but I don’t find it horrible. But then again, many people find using Python or JS horrible no matter what, so “its horrible/not-horrible” is kind of hard to generalize.
One thing to note is that there is active work in the Python community about improving the typing situation for tensors. You can search for “tensor typing” on the python typing-sig list for more insight.
Yeah, this is basically what I’m confused about. In other areas I see a million JS fans piling in proclaiming the benefits even when it makes no sense, but that just doesn’t seem to happen with ML.
JS does offer real obvious advantages over some languages and JS probably made inroads in fields where those languages are used a lot. The problem with Python vs JS is as I described in my root comment. Also Python and JS are actually very similar in day to day usage, so there’s no slam dunk case for a switch to JS.
I’ve used both JS and Python extensively for like a decade (and TS for a couple of years). I think they all very effective languages.
I’m not really convinced JS has any useful benefit over Python in these areas except for running in the browser. I think Python runs everywhere else JS would run. I don’t think running in the browser has enough benefit to enough projects to overcome the already-built institutional knowledge around Python deep learning. Institutional knowledge is very important.
I do not find this to be the case. Note that I’m not saying that Python typing is as effective as, say TS or C#, or many other languages with typing “built-in”, I’m just saying I don’t find it to be a horrible experience.
Both languages it’s hard to get a consistent experience with libraries that don’t properly implement types. On one hand DefinitelyTyped provides a larger variety of types for third party libraries than does TypeShed. On the other hand, IME, a good IDE is much more able to infer type information with your typical Python library than it is with your typical JS library.
That being said, I just don’t think many people doing deep learning stuff are doing any sort of type checking anyway.
I think if types are very important to you, depending on what about types you’re looking for, you’re much more likely to move to Java or C++ or Julia or something.
I use PyCharm, not VSCode, but it gives you a lot of that sort of thing with Python code because of it’s native support for typing and type inference. However, this isn’t a very useful comparison point without a much more detailed comparison of what each offers.
In general, I think the real answer to your question is that JS isn’t obviously better or obviously better enough and thus there’s just no push to move to JS.
I’m very open to hearing about setups that work. When I had a look there didn’t seem to be a canonical way to do it and the one or two things I tried didn’t go well.
This is definitely my impression, but it seems weird to me. As a newbie to deep learning I’m constantly unsure what rank my tensors are and working with TS has meant I don’t have to constantly break my chain of thought to read code and work it out.
Yeah, this is basically what I’m confused about. In other areas I see a million JS fans piling in proclaiming the benefits even when it makes no sense, but that just doesn’t seem to happen with ML. Maybe the answer’s just that I haven’t got the right Python setup.
I could probably help you with specific problems, but my advice is mostly going to just be “use PyCharm”.
Like I said, it’s not perfect, but I don’t find it horrible. But then again, many people find using Python or JS horrible no matter what, so “its horrible/not-horrible” is kind of hard to generalize.
One thing to note is that there is active work in the Python community about improving the typing situation for tensors. You can search for “tensor typing” on the python typing-sig list for more insight.
JS does offer real obvious advantages over some languages and JS probably made inroads in fields where those languages are used a lot. The problem with Python vs JS is as I described in my root comment. Also Python and JS are actually very similar in day to day usage, so there’s no slam dunk case for a switch to JS.