3 ms·
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 ab
by bkanber 13y ago
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.
- xd 13y agoNo 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.
- bkanber 13y agoExcellent, I'm glad to hear it! If you ever want to reach out, feel free -- email in my profile.
- ttrobertson 13y agoHow did you first come to get interested in JavaScript?
- d_j_b 13y agoThis 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.
- usamec 13y ago"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.
- bkanber 13y agoI'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.
- breuleux 13y agoJS 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?test=all&lang=v8&lang2=python3&data=u64 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?)
- 13y ago
- zenocon 13y agoArticle 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.
- yohanatan 13y agoYea, 8-space tabs is a bit ridiculous. I prefer 2 or at most 3.