Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
57
rated 0 times [  61] [ 4]  / answers: 1 / hits: 55754  / 9 Years ago, tue, july 14, 2015, 12:00:00

During my years on Python development, I've always been amazed at how much much much faster things become if you manage to rewrite that code that loops though your ndarray and does something, with numpy functions that work on the whole array at once. More recently I'm switching more and more to node, and I'm looking for something similar. So far I have turned up some things, none of which look promising:




  • scikit-node, runs scikit-learn in python, and interfaces with node. I haven't tried it, but I don't expect it gives me the cutting edge speed that I would like.

  • There are some rather old, and newer, javascript matrix libraries (sylvester, gl-matrix, ...). In addition to not being sure they work well with matrices larger than 4x4 (which is most useful in 3D rendering), they seem to be native javascript (and some, not sure these, use webGL acceleration). Great on the browser, not so on node.



As far as I know, npms can be written in C++, so I'm wondering why there are no numpy-like libraries for node. Is there just not enough interest in node yet from the community that needs that kind of power? Is there a hope that ES6 features (list comprehensions) will allow javascript compilers to automatically vectorise native JS code to C++ speeds? Am I possibly missing something else?



Edit, in response to close-votes: Note, I'm not asking for what is the best package to do xyz. I'm just wondering if there is a technical reason there is no package to do this on node, a social reason, or no reason at all and there is just a package I missed. Maybe to avoid too many opinionated criticism, I want to know: I have about 10000 matrices that are 100 x 100 each. What's the best (* correction, a reasonable fast) way to add them together?



Edit2
After some more digging, it turned out I was googling for the wrong thing. Google for node.js scientific computing and there are links to some very interesting notes:





Basically as far as I understand now, no-one has bothered so far. Also, since there are some major omissions in the js TypedArrays (such as 64bit ints), it might be hard to add good support by just using NPMs, and not hacking the engine itself --- something that would defeat the purpose. Then again, I didn't further research this last statement.


More From » c++

 Answers
9

Here is Google's TensorFlow.js (previously https://deeplearnjs.org), which does exactly that, and has built in capacities to train deep neural networks on GPUs using WebGL. You can also port TensorFlow models to it.


Don't be fooled into thinking this is only for deep learning. It is a fully fledged numerical computing platform with built-in GPU acceleration. It follows the eager "execute as you go" model, like NumPy (and Tensorflow Eager, and PyTorch, and others), not the "define then run" model like Tensorflow. As such, it will feel natural to use to anyone who has used NumPy before.


Here is the very informative Github repo:


https://github.com/tensorflow/tfjs


[#65808] Sunday, July 12, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sonja

Total Points: 541
Total Questions: 113
Total Answers: 114

Location: Anguilla
Member since Sun, Jan 29, 2023
1 Year ago
sonja questions
Mon, Nov 30, 20, 00:00, 4 Years ago
Sun, Oct 11, 20, 00:00, 4 Years ago
Thu, May 21, 20, 00:00, 4 Years ago
Sun, Nov 10, 19, 00:00, 5 Years ago
Mon, Aug 26, 19, 00:00, 5 Years ago
;