Class: SSE

Inherits:
Object show all
Includes:
TeguGears
Defined in:
lib/examples/regression.rb

Constant Summary

Constants included from TeguGears

TeguGears::REPOSITORY_CLASS

Instance Method Summary collapse

Methods included from TeguGears

included

Instance Method Details

#process(x, y) ⇒ Object

Raises:

  • (ArgumentError)


46
47
48
49
50
51
# File 'lib/examples/regression.rb', line 46

def process(x,y)
  raise ArgumentError, "x and y need to be the same size" unless x.size == y.size
  (0...x.size).inject(0.0) do |s, i|
    s + (y[i] - MaximumLikelihoodIntercept.call(x,y) - MaximumLikelihoodSlope.call(x,y) * x[i] ) ** 2
  end
end