How can I calculate the mode of a floating point array in Ruby? -


i have array of floating point data, pick out probable value. called "mode" in descriptive statistics. how can calculate in ruby, or of gem.

[0.0, 0.1, 0.2, 0.1, 0.3, 0.3, 0.1] .group_by{|e| e}.max_by{|k, v| v.length}.first # => 0.1 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

qml - Is it possible to implement SystemTrayIcon functionality in Qt Quick application -

double exclamation marks in haskell -