Module: ML::Learner::LinearToolbox

Overview

Learner toolbox for linear model

The prediction is a vector of dimension d+1 where d is the dimension of the input data

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_vectorObject

Current prediction vector



38
39
40
# File 'lib/method/toolbox.rb', line 38

def current_vector
  @current_vector
end

Instance Method Details

#lineArray

The final coefficient of the line

Returns:

  • (Array)
    a,b,c

    for ax+by+c=0 for 2-d case



51
52
53
# File 'lib/method/toolbox.rb', line 51

def line
  current_vector.column(0).to_a
end

#predict(data) ⇒ Integer

Predict certain data

Parameters:

  • data (Array)

    data in question

Returns:

  • (Integer)

    prediction



44
45
46
# File 'lib/method/toolbox.rb', line 44

def predict data
  classify_bool Matrix.column_vector(data)
end