Ruby equivalent of NumPy
I'd like to be able to get averages, medians, percentiles, etc. I've been looking all over and can't find anything like it. I realize that Ruby isn't used very much in the scientific world, but there has to exist at least a very 开发者_JS百科basic library in Ruby that does math, right?
How about ruby narray?
http://narray.rubyforge.org/
If you look at the methods, there is a section on statistics that covers your use cases:
http://narray.rubyforge.org/SPEC.en
You might also want to look at the ruby bindings to the GSL:
http://ruby-gsl.sourceforge.net/
SciRuby is working on this. We're actually working on NMatrix as a replacement for NArray. The most relevant library for you, however, would likely be Statsample.
And, as mentioned by JoshAdel, Ruby/GSL is a pretty useful gem. We have a fork of it in SciRuby's github account which supports NMatrix instead of NArray.
Unfortunately, the development of NMatrix is not active in 2019. On the other hand, NArray has improved performance and continues to release new versions.
On benchmarking, NArray is much faster than NMatrix.
I strongly recommend NArray.
https://github.com/ruby-numo/numo-narray
精彩评论