News for hackers. Stuff that matters.
Re:Machine Learning in JavaScript by bkanber on Thursday January 30, 2014 @08:03AM (#7150390)
Author here -- thanks for submitting, xd!

Let me know if you have any questions. I do intend to keep up with this series, although my pace is pretty slow at about one article every three months or so.

There are already a couple of comments about running ML in JS and how JS and the browser environment isn't terribly suited for heavy calculations. First: you're totally correct; second, I chose JS because it's

1) accessible -- whether you're Python or Ruby or PHP on the backend, you're probably comfortable with JS and

2) it demystifies machine learning -- you have to write your ML from scratch, without the help of all those wonderful Python libs, and I think this exercise shows you that it's not so mysterious after all.

Anyway, thanks for reading, and I'll poke in here throughout the day if you have questions.

Re:Machine Learning in JavaScript by xd on Thursday January 30, 2014 @09:10AM (#7150710)
No no, thank you!

I've been building a data management platform for the last 8 years and we are now at the stage where we want to provide tools to help our customers get more from their data than just statistics. As my programming experience is mainly in PHP and JS this set of articles is helping me grasp ML rather than trying to wrap my head around a new language. I'm currently working on k-means clustering and re-implementing everything in PHP to get the best possible understanding I can .. my aim after that is to see how well I can implement things at an SQL level.

Re:Machine Learning in JavaScript by bkanber on Thursday January 30, 2014 @09:16AM (#7150734)
Excellent, I'm glad to hear it! If you ever want to reach out, feel free -- email in my profile.
Re:Machine Learning in JavaScript by d_j_b on Thursday January 30, 2014 @10:45AM (#7151218)
This is great stuff - thank you very much.

>all those wonderful Python libs

As a non-mathematician I have no understanding of how wonderful they really are, which is why this sort of thing is so valuable.

Re:Machine Learning in JavaScript by zenocon on Thursday January 30, 2014 @04:08PM (#7153374)
Article looks really good! Look forward to longer read tonight. Minor nit: I'd stick with idiomatic JS style/formatting. Looks like you mixed in styles from some of the other languages (tab indentation, braces, etc.) This is always a religious argument, but I write a lot of different languages, and always just try to stick with the most popular idiomatic way, regardless of whether I care for it or not.
Re:Machine Learning in JavaScript by yohanatan on Thursday January 30, 2014 @04:47PM (#7153549)
Yea, 8-space tabs is a bit ridiculous. I prefer 2 or at most 3.
Re:Machine Learning in JavaScript by usamec on Thursday January 30, 2014 @03:03PM (#7153000)
"2) it demystifies machine learning -- you have to write your ML from scratch, without the help of all those wonderful Python libs, and I think this exercise shows you that it's not so mysterious after all." - you can demystify machine learning in any better language.

JS and PHP are slow, crappy and bug prone. Sane languages (like Python, C++) have tools to make your job easier (like numpy, blas, eigen and other libraries). They provide fast and reliable math routines so you don't have to worry about some eigenvalue decomposition, matrix multiplication and other problems.

Re:Machine Learning in JavaScript by bkanber on Thursday January 30, 2014 @03:42PM (#7153229)
I'm not sure I understand the point you're trying to make. Are you telling me I should not have written this series? That it's somehow not valuable because you don't like JS? That I can't effectively teach basic machine learning concepts to interested people without forcing linear algebra onto them? That, as a teacher, I can't try to use any and all tools and techniques available to the group I'm trying to teach?

I've even explicitly mentioned that I'm staying away from algorithms that rely on linear algebra, because I'm trying to bring these concepts to people who may not have a CS or mathematical background.

Re:Machine Learning in JavaScript by breuleux on Thursday January 30, 2014 @04:12PM (#7153397)
JS isn't particularly slow any more, thanks to the massive efforts invested in the optimization of the various competing JS engines. It is generally faster than Python 3 (http://benchmarksgame.alioth.debian.org/u64/benchmark.php?te...) and not just a little. Just for the hell of it I compared node and python on naive fibonacci. That is anecdotal, of course, but node is 30 times faster. I do agree with you that JS has horrid, bug-prone semantics, but it's impressively well optimized.

I also agree that other languages offer better tools. For instance, Python has Numpy. However, that's written in C++, not in Python. You can write plugins for Node in C++ too, so nothing would stop someone from writing a Numpy equivalent for JS. You might even be able to run it in some browsers through something like Emscripten with a performance overhead of 2-3x (I think?)

Re:Machine Learning in JavaScript by m1sta_ on Thursday January 30, 2014 @04:29PM (#7153481)
Let's not forget webCL. Gpu based matrix multiplication is available in javascript too.