Class: MLRuby::LogisticRegression::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/ML_Ruby.rb

Instance Method Summary collapse

Constructor Details

#initialize(x, y) ⇒ Model

Returns a new instance of Model.



24
25
26
27
# File 'lib/ML_Ruby.rb', line 24

def initialize(x, y)
  @x = x
  @y = y
end

Instance Method Details

#predict(nexts) ⇒ Object



28
29
30
31
32
# File 'lib/ML_Ruby.rb', line 28

def predict(nexts)
  script_path = "#{Gem.loaded_specs['ML_Ruby'].gem_dir}/lib/python/logistic_regression.py"
  result = `#{MLRuby::PYTHON_PATH} #{script_path} "#{@x}, #{@y}, #{nexts}"`
  result.gsub("\n","").gsub("[","").gsub("]","").split(" ").map(&:to_i)
end