Sha256: 4bfd838f032d60114bf4e8d1c6cd8e2ce2d4928e244410e3927a956cca17c474

Contents?: true

Size: 461 Bytes

Versions: 1

Compression:

Stored size: 461 Bytes

Contents

require 'glm'
require 'pp'
require 'ruby-debug' ; Debugger.start(:post_mortem => true)
Debugger.settings[:autoeval] = true
require 'prepare'

T = 200

iris = load_iris
y_arr = iris.map {|r| r[-1].to_i}
y = GSL::Vector.alloc y_arr
x = iris.map {|r| r[0...-2]}
x = x.map{|r| r << 1}
x = GLM::Util.aa_to_gsl_matrix x

glm = GLM::Logit.new(x, y, 0.1)

(1..T).each do |i|
  glm.sto_update
  est_y =  glm.est(x)
  err = (est_y - y).nrm2
  puts err
  pp glm.theta
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glm-0.0.2 examples/test_glm_logit.rb