Class: SupervisedLearning::LogisticRegression
- Inherits:
-
Object
- Object
- SupervisedLearning::LogisticRegression
- Defined in:
- lib/supervised_learning.rb
Overview
This class uses logistic regression to make discrete predictions (true or false) based on a training set. The algorithms in #predict were provided by Andrew Ng (Stanford University).
Instance Method Summary collapse
-
#initialize(training_set) ⇒ LogisticRegression
constructor
Initializes a LogisticRegression object with a training set.
Constructor Details
#initialize(training_set) ⇒ LogisticRegression
Initializes a LogisticRegression object with a training set
157 158 159 160 161 |
# File 'lib/supervised_learning.rb', line 157 def initialize(training_set) @training_set = training_set raise ArgumentError, 'input is not a Matrix' unless @training_set.is_a? Matrix raise ArgumentError, 'Matrix must have at least 2 columns and 1 row' unless @training_set.column_size > 1 end |