mathjs icon indicating copy to clipboard operation
mathjs copied to clipboard

[Question] Can this be used in place of R?

Open quantuminformation opened this issue 9 years ago • 9 comments

quantuminformation avatar Oct 18 '17 21:10 quantuminformation

In a word, no

We might be able to help you more if you share what you are trying to achieve instead, as R and MathJS aren't usefully comparable. R is an entire language, MathJS is a library, the things they have in common are an expression parser (a subset of many languages) and a collection of builtin functions.

MathJS is more like a math library (just as there would be math libraries for R or Python), additionally it has a very good expression parser which makes using various math operators and functions much more pleasant in JavaScript, and similar to something like mathematica.

ThomasBrierley avatar Oct 19 '17 11:10 ThomasBrierley

In summary, I am a web developer that would like to use the tools I am comfortable with (JavaScript) for data science.

Since lots of the statistics packages don't exist for js, It seems I need to use R then transfer its output to the web by exporting using its own api. I also need to import the data from the web to R by using some R package it seems. It's a shame because I can do all this already in JS now I need to learn how to do it in R?

quantuminformation avatar Oct 19 '17 12:10 quantuminformation

Since lots of the statistics packages don't exist for js, It seems I need to use R then transfer its output to the web by exporting using its own api.

I also need to import the data from the web to R by using some R package it seems. It's a shame because I can do all this already in JS now I need to learn how to do it in R?

I see, so you need the functionality of specific statistical packages in R, and would prefer to have the same functionality available in JavaScript. And the alternative is to find a common data format between the two languages and libraries (most likely with some conversion or serialisation in-between).

I'm not a data scientist, maybe there are others here but you might get more info faster if you share the specific features of these R libraries you are trying to use, the features/functions you require may already exist in mathjs, or they may be easy enough to implement (you can also easily customise and extend mathjs with your own functions and operators if they are not very up-streamable for some reason).

ThomasBrierley avatar Oct 19 '17 13:10 ThomasBrierley

I have not tried R or math.js that much but I've been reading a lot about data science lately and have similarly been interested in using java script as my language of choice. Java script has many advantages compared to the other script languages and actually performs better then python in many cases. The only place it falls short at the moment is the actual number crunching and the reason is that python, and R uses packages written in C and fortran to do the actual math. This makes them really fast and this becomes crucial when you want to process really big datasets.

Math.js seems like a great library and have one of the best api's I've seen, however performance wise it does not seem to be a good choice for serious data science where you care about speed. I would love to see some performance improvement to math.js and see it become javascripts answer to numpy/scipy but until then I would try to look at some other solution. For javascript vectorious might be an alternative.

robinjac avatar Feb 23 '18 09:02 robinjac

Thanks for your input @robinjac. Yeah I would love to improve the performance of mathjs too :D

josdejong avatar Feb 23 '18 10:02 josdejong

Maybe you should look into collaborating with deeplearnjs, they are high perf.

quantuminformation avatar Feb 23 '18 14:02 quantuminformation

Yes definitely. There are a couple of libraries that could be interesting to integrate, like ndarray.

josdejong avatar Feb 24 '18 13:02 josdejong

Or look into GPU powered solutions, see http://gpu.rocks/

josdejong avatar Feb 24 '18 13:02 josdejong

Anyone interested in looking into better performing matrix implementations for math.js?

josdejong avatar Feb 24 '18 13:02 josdejong