Class: SSXY
Constant Summary
Constants included from TeguGears
Instance Method Summary collapse
Methods included from TeguGears
Instance Method Details
#process(x, y) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/examples/regression.rb', line 13 def process(x, y) raise ArgumentError, "x and y need to be the same size" unless x.size == y.size x_mean = Mean.call(*x) y_mean = Mean.call(*y) (0...x.size).inject(0.0) {|s,i| s + (y[i] - y_mean) * (x[i] - x_mean) } end |