News for hackers. Stuff that matters.
Re:First-Class Automatic Differentiation in Swift by blt on Monday October 22, 2018 @12:03AM (#18272093)
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.
Re:First-Class Automatic Differentiation in Swift by rpeden on Monday October 22, 2018 @07:00AM (#18273617)
For 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)

Re:First-Class Automatic Differentiation in Swift by 0xfaded on Monday October 22, 2018 @08:25AM (#18274046)
> 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".

Re:First-Class Automatic Differentiation in Swift by ThePadawan on Monday October 22, 2018 @10:45AM (#18275037)
You 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..."

Re:First-Class Automatic Differentiation in Swift by gerdesj on Monday October 22, 2018 @08:51AM (#18274183)
What do you do about any confusion arising from MG also being a long standing abbreviation for Machine Gun?
Re:First-Class Automatic Differentiation in Swift by AllegedAlec on Monday October 22, 2018 @11:29AM (#18275437)
Or Morris Garages.
Re:First-Class Automatic Differentiation in Swift by jurip on Monday October 22, 2018 @01:01AM (#18272300)
I 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.
Re:First-Class Automatic Differentiation in Swift by wodenokoto on Monday October 22, 2018 @01:43AM (#18272442)
Julia 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

Re:First-Class Automatic Differentiation in Swift by bmc7505 on Monday October 22, 2018 @02:19AM (#18272567)
Julia has some form of typing checking, but it is not statically typed. https://docs.julialang.org/en/v1/manual/types/index.html
Re:First-Class Automatic Differentiation in Swift by wodenokoto on Monday October 22, 2018 @03:05AM (#18272726)
Thank 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?

Re:First-Class Automatic Differentiation in Swift by tkoolen on Monday October 22, 2018 @07:54AM (#18273885)
Here'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.

Re:First-Class Automatic Differentiation in Swift by cultus on Monday October 22, 2018 @10:51AM (#18275092)
Just 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.
Re:First-Class Automatic Differentiation in Swift by skohan on Monday October 22, 2018 @10:24AM (#18274888)
The 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.

Re:First-Class Automatic Differentiation in Swift by netheril96 on Monday October 22, 2018 @02:24AM (#18272584)
Google uses Linux in production and is responsible for TF Swift, so certainly Linux will be first class.
Re:First-Class Automatic Differentiation in Swift by chewxy on Monday October 22, 2018 @02:22AM (#18272576)
Statically typed? As in Go? I invite you to work on 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) . 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.

Re:First-Class Automatic Differentiation in Swift by cultus on Monday October 22, 2018 @10:48AM (#18275059)
Not that Go is bad, but it does lack operator overloading, which can make numerical stuff kind of annoying.
Re:First-Class Automatic Differentiation in Swift by Isn0gud on Monday October 22, 2018 @04:40AM (#18273080)
tensorflow has a c++ API and PyTorch is going to have one too with 1.0 ?!
Re:First-Class Automatic Differentiation in Swift by p1esk on Monday October 22, 2018 @12:22AM (#18272162)
I desperately want to write my ML code in a statically typed language

Why? What kind of ML code do you write?

Re:First-Class Automatic Differentiation in Swift by marmaduke on Monday October 22, 2018 @04:24AM (#18273020)
Re:First-Class Automatic Differentiation in Swift by amelius on Monday October 22, 2018 @04:43AM (#18273094)
> 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.

Re:First-Class Automatic Differentiation in Swift by geezerjay on Monday October 22, 2018 @05:06AM (#18273179)
Type 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.
Re:First-Class Automatic Differentiation in Swift by Cybiote on Monday October 22, 2018 @06:26AM (#18273481)
Type 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.

Re:First-Class Automatic Differentiation in Swift by mhh__ on Monday October 22, 2018 @10:03PM (#18280212)
C++ or D: C++ for obvious reasons, D for aesthetics (at least) + more functional approach
Re:First-Class Automatic Differentiation in Swift by pacala on Monday October 22, 2018 @12:35AM (#18272211)
pylint + typing might do the job.