5 ms·
I desperately want to write my ML code in a statically typed language. I hope one of these Swift-based projects takes off. But I am worried that they will not t
by blt 8y ago
I desperately want to write my ML code in a statically typed language. I hope one of these Swift-based projects takes off. But I am worried that they will not treat Linux as a first-class platform.
- p1esk 8y agoI desperately want to write my ML code in a statically typed language Why? What kind of ML code do you write?
- pacala 8y agopylint + typing might do the job.
- jurip 8y agoI guess Apple's ML efforts are focused on Core ML and friends and will probably treat Linux as second class or won't support it at all. But Google works on Tensorflow, Lattner wants to do it with Swift and I'd assume that for them Linux absolutely is the primary target.
- wodenokoto 8y agoJulia might tick all boxes. It advertised the following: fast, has native automatic differentiation and type checking. It definitely doesnt treat Linux as second or third class
- bmc7505 8y agoJulia has some form of typing checking, but it is not statically typed. https://docs.julialang.org/en/v1/manual/types/index.html https://docs.julialang.org/en/v1/manual/types/index.html
- wodenokoto 8y agoThank you for pointing that out, and sharing a link to the relevant documentation. Is the main difference between static typing and Julia (from a user point of view) that type declaration/checking is only optional in Julia? Or put in another way, what does Julia lose compared to a statically typed language?
- tkoolen 8y agoHere's a quick comparison to C++. Julia relies heavily on type inference, similar to all variables to be marked auto or auto& by default in C++. Functions are templated on the argument types by default, in C++ terms. So if you call a function f(x) first with an integer and then with a floating point number, Julia will generate separate machine code optimized for each case. Annotating function arguments with types only serves as a filter for whether the function applies to certain types, and can be used for method overloading (function template specialization in C++). The fact that functions are generic by default lends itself well to forward-mode automatic differentiation using method overloading. Julia is still a dynamic language though. This means that if a variable is bound to an integer in one branch of an if-statement while a string is assigned to it in another branch depending on the value (not type) of a function input, then the variable's type cannot be inferred and needs to be 'boxed', i.e. the runtime type needs to be stored along with the data. In such cases, function dispatch can no longer be done at compile time, and needs to be done dynamically instead. While this is useful for rapid prototyping, it does result in reduced performance, so it should be avoided in code with high performance requirements. The type elision part of this is somewhat similar to boost::any.
- chewxy 8y agoStatically typed? As in Go? I invite you to work on Gorgonia (https://github.com/gorgonia/gorgonia https://github.com/gorgonia/gorgonia). It's written in Go, and neural networks written with Gorgonia has a decent type system (https://github.com/chewxy/hm https://github.com/chewxy/hm) . It uses dual numbers for differentiation. On top of that, the meta language, Go is also statically typed. We need help on various things: compilation optimizations, more operators, etc. Well typed, as in Haskell? I invite you to work on Grenade.
- cultus 8y agoNot that Go is bad, but it does lack operator overloading, which can make numerical stuff kind of annoying.
- netheril96 8y agoGoogle uses Linux in production and is responsible for TF Swift, so certainly Linux will be first class.
- marmaduke 8y agotry Owl for OCaml, https://github.com/owlbarn/owl/blob/master/README.md https://github.com/owlbarn/owl/blob/master/README.md
- Isn0gud 8y agotensorflow has a c++ API and PyTorch is going to have one too with 1.0 ?!
- amelius 8y ago> I desperately want to write my ML code in a statically typed language. Why? ML programs are typically sufficiently compact to not require a type system.
- geezerjay 8y agoType errors can happen in small programs. In ML applications, which are computationally very expensive and take a lot of time to run, an avoidable type error can result in a considerable waste of time.
- Cybiote 8y agoType annotations can be useful in helping a reader get a rough outline at a glance, of what some unfamiliar piece of code is doing. Especially under heavy use of broadcasting. The second is compactness is true only if you're chaining straightforward library calls. If you're writing your own functions or building non-trivial functionality on top, types will be of aid too.
- rpeden 8y agoFor anyone confused, by ML blt means machine learning. The confusion might arise since ML is also a statically typed programming language, usually seen in the wild in the form of Standard ML and OCaml: https://en.wikipedia.org/wiki/ML_(programming_language) https://en.wikipedia.org/wiki/ML_(programming_language)
- 0xfaded 8y ago> I desperately want to write my ML code in a statically typed language. As annoying as it is to see the ML name being hijacked, that has to be one of the funniest inadvertent comments HN has ever produced. I prefer MG, for Machine Guessing. This not only conveys "The machine has guessed a mapping from x to y", but also captures the research side of "I don't know what the machine is really doing anymore so here are my guesses".
- gerdesj 8y agoWhat do you do about any confusion arising from MG also being a long standing abbreviation for Machine Gun?
- AllegedAlec 8y agoOr Morris Garages.
- ThePadawan 8y agoYou should know that your comment comes across much like... "I'd just like to interject for a moment. What you’re referring to as ML, is in fact, GNU/ML, or as I’ve recently taken to calling it, GNU plus ML..."
- skohan 8y agoThe story for Swift on Ubuntu is actually quite good now, and is getting better all the time. I was an early adopter of cross-platform Swift and it's night and day from where it was even 18 months ago. Also it's been announced that LSP support for swift will be a priority, so tooling should be improving substantially in the near future.
- cultus 8y agoJust use C++. Modern C++ is really quite nice, and definitely has by far the best numerical libraries of any statically typed lang. Plenty of ML packages (most of the big names are written in C++, after all). Eigen3 is also the best linear algebra package I've used outside of Julia.
- mhh__ 8y agoC++ or D: C++ for obvious reasons, D for aesthetics (at least) + more functional approach