Class: Ai4r::Classifiers::NaiveBayes::DataEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/ai4r/classifiers/naive_bayes.rb

Overview

DataEntry stores the instance of the data entry the data is accessible via entries stores the class-column in the attribute klass and removes the column for the class-entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes, klass) ⇒ DataEntry

Returns a new instance of DataEntry.



246
247
248
249
# File 'lib/ai4r/classifiers/naive_bayes.rb', line 246

def initialize(attributes, klass)
  @klass = klass
  @entries = attributes
end

Instance Attribute Details

#entriesObject

Returns the value of attribute entries.



244
245
246
# File 'lib/ai4r/classifiers/naive_bayes.rb', line 244

def entries
  @entries
end

#klassObject

Returns the value of attribute klass.



244
245
246
# File 'lib/ai4r/classifiers/naive_bayes.rb', line 244

def klass
  @klass
end

Instance Method Details

#[](index) ⇒ Object

wrapper method for the access to @entries



252
253
254
# File 'lib/ai4r/classifiers/naive_bayes.rb', line 252

def [](index)
  @entries[index]
end