TensorFlow.js: Machine Learning for the Web and Beyond
arxiv.org
arxiv.org
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.
A quick search brought me here(https://stackoverflow.com/questions/30610675/python-pandas-e...) and here (https://stratodem.github.io/pandas.js-docs/#introduction)— not sure pandas-js is maintained any longer, though.
edit: In that SO question, there's a pointer to Apache Arrow which appears to be maintained more regularly, with types—and library support for multiple languages. Never used it, myself, though.
A review of some options here.
JS can be verbose, but I find that functional style JS is, in my opinion, a bit more readable than Python list comprehensions.
???
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.htmlOnce 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). > a = np.array([1, 2, 3, 4, 5])
> a * 10
array([10, 20, 30, 40, 50])
> a[a < 3]
array([1, 2])
It's even nicer in languages with builtin vectors like R: > a1 = 1:5
> a2 = c(2, 4, 6, 8, 10)
> a1 + a2
3 6 9 12 15
In Pandas, you can add a new dataframe column that's the result of arithmetic operations on other numeric columns. > df["New Column Name"] = df.Col1 * (df.Col2 / df.Col3) let a = [1, 2, 3, 4, 5]
> a.map(x => x * 10)
(5) [10, 20, 30, 40, 50]
> a.filter(x => x > 3)
(2) [4, 5]
> a1.map((x,i) => x + a2[i])
(5) [3, 6, 9, 12, 15]
I don't hate broadcasting, but it can get a bit cryptic at times. Once the filtering starts getting complex, it can be a bit difficult to read unless you start breaking things out into variables and chaining filters together.For JS, something similar to pandas creating a new column based on operations of other columns would be to do map an array of objects (list of dicts) and use a (Schwartzian_transform)[https://en.wikipedia.org/wiki/Schwartzian_transform] to create a new object property. I would love to look into how efficient these sort of operations can be, have had some success with this sort of thing for performing cosine similarity in the browser instead of creating sparse matrices with python.
But for simpler operations, if you're doing a lot of vector computations, then map and filter bloat the code considerably when the mathematical notation is easy to read.
Good luck with work on the JS implementation and efficiency comparisons. Pandas utilizes a Series object built on top of NumPy array for handling columns and rows. I don't know whether a similar approach would be helpful in JS.
Making apps interactive with poses or with speech commands are two examples that jump out.
It's a classic example of how machine learning is used.
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.
That or you just didn't read the full comment?
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.
> Are you just trying to say you love React, Node, Java...
No stack I advocate in particular. I'm trying to say that the web is a wonderful platform and I hope it will stay for a very-very long time.
For the client side ML libraries, I don't think it makes sense to use it for tracking. You can already extract information with a high accuracy.
Tracking is a natural consequence of money flowing into the industry and tracking can be achieved with high accuracy. I'm not saying it's a good thing, but at least we can do something about it.
Not sure how that's relevant, but yeah the web just gets worse and worse every year. Mostly due to the corporations of course, but the standards group are culpable too. I kind of want to write a book on the history of the W3C if nobody has already, it's such a horror show.
All these javascript "advances" just make it easier for people to e.g. mine monero on my system without my consent and enable mediocre web developers to load up previously quick-loading sites with custom scrolling animations, autoplay video, and malvertising.
I'm sure it's in better shape for you, a web developer. It's objectively worse for me, a user.
Oh believe me, this stuff was added a long time ago. This is a benefit though. Of course these people will want to offload some of that heavy ML computing onto the browser so they don't have to pay for their own cluster of p3.16xlarge or whatever. Which makes it easier to block and opt-out.
EDIT: Example - https://www.adobe.com/marketing-cloud/target/automation.html
So yes, anyone surreptitiously gaining access to your camera or mic feed through the browser would get into heaps of trouble and invite bad press, especially if they were able to find a way around the consent dialog.
I have the FREEDOM of discharging a gun is different than I have the FREEDOM of discharging a gun into a person's brain are two very different things.
It's better to be generous with credit than stingy.