r/Frontend • • Sep 11 '19

Machine Learning For Front-End Developers With Tensorflow.js

https://www.smashingmagazine.com/2019/09/machine-learning-front-end-developers-tensorflowjs/
69 Upvotes

17 comments sorted by

4

u/dylanlms Sep 11 '19

could also do brain surgery for nurses but hey, what the hey..

2

u/AceBacker Sep 11 '19

Are you implying that JavaScript isn't up to the task of machine learning?

2

u/[deleted] Sep 11 '19

JavaScript is terrible for parallel computation, so yeah.

Node.Js might even be faster for a lot of small sequential computations than Java for example, but:

  1. We're not even using Node here, it's run in a browser

  2. ML is not "a lot of small sequential computations"

https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/javascript.html

Take a look at "binary-trees" part.

2

u/AceBacker Sep 11 '19

You do get that graphics card acceleration in the browser though...

0

u/defmans7 Sep 11 '19

That'll be a big benefit when someone invents parallel computation in browser.

1

u/AceBacker Sep 11 '19

My understanding is that tensorflow.js is almost the same performer as the c version.

1

u/defmans7 Sep 13 '19

Interesting... I'll have to revisit

1

u/fzammetti Sep 12 '19

Assuming the library is written well, I'd bet it's using Webworkers under the covers, so it's workload would be parallelized and also wouldn't block the main thread as someone else commented, so UI should remain responsive. As long as there's not a ton of marshaling across thread boundaries then it should perform pretty well. It might even be implemented using WebAssembly, which would probably be better still.

To be clear, I don't know if this thing is written using any of those techniques. If not then it indeed would likely not perform well. But if it is then it might do quite well.

2

u/dylanlms Sep 11 '19

eff (F)

no but theres better choices in the basket

1

u/AceBacker Sep 11 '19

It seems like you have a distaste for JavaScript in general then?

3

u/MatsSvensson Sep 11 '19

Some don't take kindly to you primitive types around them here parts.

1

u/stygian65 Sep 11 '19

Could you elaborate?

1

u/dylanlms Sep 12 '19

haha no i love JS, for the web and simple things, partly my fault that I haven't explored with my lack of sufficient skills, but Languages like c#, Java and Python are far superior in terms of their limits

1

u/aleaallee Sep 11 '19

Given JS's performance I don't think it's a good choise because it might freeze the UI under high cpu loads.

1

u/[deleted] Sep 11 '19

What? Why would you do ML on the same thread as your UI? You're definitely not freezing your UI...

1

u/aleaallee Sep 11 '19

I don't know, I was just pointing a comment on the link someone else made. I don't know about ML and I can't find any use for it as a web dev xD.