Class: GLM::Linear
Class Method Summary collapse
-
.g(eta) ⇒ Object
Canonical response function It’s identity function here, obviously.
Instance Method Summary collapse
- #hi ⇒ Object
-
#ne_est(x) ⇒ Object
Normal equation estimation.
-
#ne_fit ⇒ Object
Normal equation fit.
Methods inherited from Base
#T, #a, #b, #est, #eta, #format, #gradient, #h, #initialize, #output, #single_update, #sto_update, #theta
Constructor Details
This class inherits a constructor from GLM::Base
Class Method Details
.g(eta) ⇒ Object
Canonical response function It’s identity function here, obviously
13 14 15 |
# File 'lib/glm/linear.rb', line 13 def self.g(eta) return eta end |
Instance Method Details
#hi ⇒ Object
6 7 8 |
# File 'lib/glm/linear.rb', line 6 def hi return "Hi, this is #{self.class}" end |
#ne_est(x) ⇒ Object
Normal equation estimation
18 19 20 21 |
# File 'lib/glm/linear.rb', line 18 def ne_est(x) @theta = ne_fit [@theta, x * @theta] end |
#ne_fit ⇒ Object
Normal equation fit
24 25 26 |
# File 'lib/glm/linear.rb', line 24 def ne_fit ( @x.transpose * @x ).invert * @x.transpose * @y end |