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.



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

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

Instance Attribute Details

#entriesObject

Returns the value of attribute entries.



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

def entries
  @entries
end

#klassObject

Returns the value of attribute klass.



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

def klass
  @klass
end

Instance Method Details

#[](index) ⇒ Object

wrapper method for the access to @entries



256
257
258
# File 'lib/ai4r/classifiers/naive_bayes.rb', line 256

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