Class: MLRuby::DecisionTreeClassifier::Model

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

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Model

Returns a new instance of Model.



52
53
54
# File 'lib/ML_Ruby.rb', line 52

def initialize(data)
  @data = data
end

Instance Method Details

#predict(next_x) ⇒ Object



55
56
57
58
59
# File 'lib/ML_Ruby.rb', line 55

def predict(next_x)
  script_path = "#{Gem.loaded_specs['ML_Ruby'].gem_dir}/lib/python/decision_tree_classifier.py"
  result = `#{MLRuby::PYTHON_PATH} #{script_path} "#{@data}, #{next_x}"`
  result.to_i
end