Class: MLRuby::LinearRegression::Model
- Inherits:
-
Object
- Object
- MLRuby::LinearRegression::Model
- Defined in:
- lib/ML_Ruby.rb
Instance Method Summary collapse
-
#initialize(x, y) ⇒ Model
constructor
A new instance of Model.
- #predict(next_x) ⇒ Object
Constructor Details
#initialize(x, y) ⇒ Model
Returns a new instance of Model.
10 11 12 13 |
# File 'lib/ML_Ruby.rb', line 10 def initialize(x, y) @x = x @y = y end |
Instance Method Details
#predict(next_x) ⇒ Object
14 15 16 17 18 |
# File 'lib/ML_Ruby.rb', line 14 def predict(next_x) script_path = "#{Gem.loaded_specs['ML_Ruby'].gem_dir}/lib/python/linear_regression.py" result = `#{MLRuby::PYTHON_PATH} #{script_path} "#{@x}, #{@y}, #{next_x}"` result.to_f end |