Live data from Hacker News

Why data scientists should start learning Swift

heartbeat.fritz.ai

21–30 of 67 posts

Re: Why data scientists should start learning Swift

#22

While the author says "Don’t mistake Swift for TensorFlow as a simple wrapper around TensorFlow to make it easier to use on iOS devices." , the only thing Python is missing from his wishlislist of features is "6. Native execution on mobile". "7. Performance closer to C" is a non-issue - all the parts where performance matters are going to run on CUDA anyway and there's no performance hit there, and very little comput…

Still an issue, just not where you think. For recent, more efficient CNN architectures _data augmentation_ is a bottleneck when done on a single thread. So Python has to resort to either queues and async (TF approach, worse perf than PyTorch in practice), or use multiprocessing (PyTorch approach, works better but ugly AF under the covers). I would absolutely love to use a multi core-capable language there. The machine does have several dozen cores after all.

Re: Why data scientists should start learning Swift

#24

Earlier quoted context omitted.

Heh, because 1-based arrays are gross. I'm poking fun of course, but you really shouldn't underestimate how many people are turned off of Julia by this.

It's not like it's the first. Doesn't Fortran default to 1-based? R and Matlab are also 1-based. Julia like those two are aimed at a mathematical domain, not zero-based offsets. Anyway, it's not hard to get used to.

"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration." -- Stan Kelly-Bootle

Re: Why data scientists should start learning Swift

#25

Does Swift have the libraries that Python/Matlab has? My wife is doing some kind of fMRI analysis/research for her PhD and she's using Matlab. I'm an iOS developer, so I'd love it if I can get her to use Swift!

If you mean the matlab toolboxes (eg, image processing toolbox), which are proprietary libraries that you pay like $1k per year to use, no.

Honestly, as someone who wrote matlab professionally for a couple years, the price is a joke, and the performance is jokier. The only reason that matlab still exists is that they use the same marketing tactics as drug dealers- it's free to universities, and super easy to use.

Re: Why data scientists should start learning Swift

#26

Please stop balkanizing the scientific software development community. Python has excellent wrappers for many other excellent scientific libraries which in turn leverage C and Fortran for high performance computing.

When people say Python, I never know if they mean 2.7, 3.x, or both, or are unaware that there's a difference, or don't realize how much it matters in practice... so a language that has clear forward momentum, focuses on the latest version, and quickly deprecates old versions is pretty welcome.

Re: Why data scientists should start learning Swift

#27

Earlier quoted context omitted.

It's not like it's the first. Doesn't Fortran default to 1-based? R and Matlab are also 1-based. Julia like those two are aimed at a mathematical domain, not zero-based offsets. Anyway, it's not hard to get used to.

A bunch of wrongs don't make a right :-) And honestly, it's because I do numerical programming that I value zero-based offsets. In addition to subscripting arrays (which I could do in any base), I use those subscripts in the math itself. For instance, the zeroth bin of an FFT indicates the zero frequency. I also choose the zeroth array element to represent the constant term (zeroth power) of a polynomial, and so on.…

Generally math formulae are one based, the fft and the Taylor expansions being the major exception. Natural numbers, by convention, unless you're bourbaki, start at one.

I do appreciate that zero is easier because of offset caluculations, but you really do get used to it and in most cases the compiler figures it out with almost no penalty.

Re: Why data scientists should start learning Swift

#28
post #24

Earlier quoted context omitted.

It's not like it's the first. Doesn't Fortran default to 1-based? R and Matlab are also 1-based. Julia like those two are aimed at a mathematical domain, not zero-based offsets. Anyway, it's not hard to get used to.

"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration." -- Stan Kelly-Bootle

Also:

  $[ = 1;
(Yes, I'm _old_...)

Re: Why data scientists should start learning Swift

#29

Earlier quoted context omitted.

It's not like it's the first. Doesn't Fortran default to 1-based? R and Matlab are also 1-based. Julia like those two are aimed at a mathematical domain, not zero-based offsets. Anyway, it's not hard to get used to.

A bunch of wrongs don't make a right :-) And honestly, it's because I do numerical programming that I value zero-based offsets. In addition to subscripting arrays (which I could do in any base), I use those subscripts in the math itself. For instance, the zeroth bin of an FFT indicates the zero frequency. I also choose the zeroth array element to represent the constant term (zeroth power) of a polynomial, and so on.…

> A bunch of wrongs don't make a right :-)

Funny how I always thought zero-based numbering[0] was a hack. Just in computer science a hack will become the right way? Any other fields where hacks became the new norm due to technical restrictions?

Your statement is a opinion.

To add to the list of languages using arrays in a "gross" way: pgsql, pascal, lua.

[1]: https://en.wikipedia.org/wiki/Zero-based_numbering#Origin

Re: Why data scientists should start learning Swift

#30

Earlier quoted context omitted.

Heh, because 1-based arrays are gross. I'm poking fun of course, but you really shouldn't underestimate how many people are turned off of Julia by this.

It's not like it's the first. Doesn't Fortran default to 1-based? R and Matlab are also 1-based. Julia like those two are aimed at a mathematical domain, not zero-based offsets. Anyway, it's not hard to get used to.

https://en.wikipedia.org/wiki/Comparison_of_programming_lang...
Post reply on HN