
TensorFlow.js: Machine Learning for the Web and Beyond - lainon
https://arxiv.org/abs/1901.05350
======
fredley
[Atwood's Law]

This was inevitable I guess, but does anyone know if there's a decent Pandas
equivalent for Javascript? I'd love to be able to handle reasonably large
datasets in Javascript as easily as I can in Python.

~~~
goatlover
One thing that Python has that JS lacks is operator overloading, which allows
for adding broadcasting. It's really nice to be able to do builtin math
operations on Pandas columns or NumPy arrays. That's why languages like R,
Julia and APL have broadcasting built in to the language. The mathematical
notation is more natural and less cumbersome.

~~~
rajangdavis
Two things that JS has over Python is lexical scoping and map/reduce/filter
and lambda support.

JS can be verbose, but I find that functional style JS is, in my opinion, a
bit more readable than Python list comprehensions.

~~~
whalesalad
> Two things that JS has over Python is lexical scoping and map/reduce/filter
> and lambda support.

???

Python does all of that. There are native map/reduce/filter methods in the
standard library.

    
    
        >>> x = [1, 2, None, 3]
        >>> list(filter(None, x))
        [1, 2, 3]
    

and then map

    
    
        >>> list(map(float, [1, 2, 3]))
        [1.0, 2.0, 3.0]
    

Lambda's are everywhere in Python:

    
    
        >>> double = lambda x: x * 2
        >>> list(map(double, range(3)))
        [0, 2, 4]
    

[https://docs.python.org/3/library/functions.html](https://docs.python.org/3/library/functions.html)

~~~
rajangdavis
I know that they exist, but if you look at your examples, you have to manually
cast maps into a list which is a bit strange coming from Ruby/JS/Scala.

Once you have something sufficiently complex (such as using map, filter, and
reduce all at the same time), there becomes so much line noise that it starts
working against you.

With JS/Ruby/Scala, you chain functional methods as opposed to Python where
you can keep wrapping functions.

Something like

    
    
      let arr =  [0,1,2,'test'];
    
      arr
        .filter(x => typeof(x) == 'number')
        .map(x => x*2)
        .reduce((x, y) => x * y)
    

becomes a little more cryptic with Python:

    
    
      from functools import reduce
    
      arr = [0,1,2,'test']
    
      # with lambdas
      reduce(lambda x,y: x + y, map(lambda x: x * 2, filter(lambda x: type(x) == int, arr)))
    
      # list comprehension equivalent
      sum([x * 2 for x in arr if type(x) == int])
    

While Python is very beginner friendly, it has a really strange (in my
opinion) approach to functional concepts. However, it is has other features
that make it really nice to work with (like decorators, data classes, sets,
robust ML libraries, really nice built ins).

~~~
naveen99
Chaining function calls makes things harder to debug, so I don’t do it.

~~~
rajangdavis
I don't think it's any harder than broadcasting... I try to avoid chaining
unless I know the structure of the data I am working with.

------
eddieone
I am a huge fan TFJS. I have used it in one project and hope to use it again.
Having TF compatible neural nets in the browser and inside Node, it's a game
changer. Google was smart to buy Deepmind.

~~~
spongepoc
TensorFlow isn't a DeepMind project

------
dak1
For everyone wondering what this could be useful for, take a look at
[https://github.com/tensorflow/tfjs-
models](https://github.com/tensorflow/tfjs-models) for a few ideas.

Making apps interactive with poses or with speech commands are two examples
that jump out.

------
abetlen
This and ONNX.js are two projects I'm following very closely even as someone
who mostly only works in PyTorch or Tensorflow. I think they both have a lot
of potential to reduce the cost of deploying machine learning solutions,
especially with everyone in the cloud essentially paying the Nvidia tax.

------
didip
If I can ask for 1 feature request for TensorFlow.js: It would be nice if the
library abstracts out DOM objects (window, document, etc.).

~~~
rajangdavis
Out of curiosity, why do you need this? Tensorflow is for tensor/matrix
operations; I can't think of a reason why it would need to abstract out DOM
objects.

------
dinghy
Crazy tech!

------
endofcapital
I didn't think the web could get any more terrible than it is today, but if
everyone starts adding ML to all the tracking/targeting/adware systems then
that seems to be a new deeper level of hell.

~~~
kowdermeister
> the web could get any more terrible than it is today

Please cry a river how bad it is. As someone actively developing since about
2006 I think it's never been in a better shape.

~~~
coding123
Please respond to the actual concern, you cut out the entirely relevant part
of his comment. Are you just trying to say you love React, Node, Java - cause
that's what it sounds like you're saying which has nothing to do with his
concern over ML to enhance tracking, etc.. If you think the tracking, etc..
has been getting better since 2006, then it clearly means you're advocating
it.

That or you just didn't read the full comment?

~~~
onion2k
_If you think the tracking, etc.. has been getting better since 2006, then it
clearly means you 're advocating it._

Tracking is far better now than it was in 2006, and I say that as someone who
is _hugely_ against tracking. We have the Do Not Track header, which a lot of
companies actually pay attention to, we have much better privacy plugins and
ad-blockers (privacy badger, u-block origin, pi-hole, etc), and we have a
growing consensus that tracking isn't actually that effective which seems to
be pushing some companies to try alternative models in their advertising
revenue, and their ad spend on the other side.

Things _are_ better.

~~~
DevKoala
This is not true, tracking is more prevalent than ever. Legislation and public
backlash have forced service providers to ask before they track. However,
advancements in ML and commoditization of big data engineering solutions have
made it easier than ever for more events to be tracked and more accurate
profiling to be possible.

------
1024core
What, no Jeff Dean?!

~~~
tanilama
TF.js is just a wrapper. It develops independently with TF's core.

------
focom
20 authors ? Is a follow back on Twitter enough to get 10th author on a paper?

~~~
dgacmu
Why disparage their work? It's a large engineering effort. It's likely that
only a few of the authors wrote a majority of the text in the paper, but it's
appropriate and worthwhile to give recognition to the folks who did
engineering work on the artifact being described as well.

It's better to be generous with credit than stingy.

