Class: Weka::Core::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/weka/core/attribute.rb

Instance Method Summary collapse

Instance Method Details

#internal_value_of(value) ⇒ Object

The order of the if statements is important here, because a date is also a numeric.



13
14
15
16
17
18
19
# File 'lib/weka/core/attribute.rb', line 13

def internal_value_of(value)
  return value                      if value === Float::NAN
  return Float::NAN                 if [nil, '?'].include?(value)
  return parse_date(value.to_s)     if date?
  return value.to_f                 if numeric?
  return index_of_value(value.to_s) if nominal?
end

#valuesObject



7
8
9
# File 'lib/weka/core/attribute.rb', line 7

def values
  enumerate_values.to_a
end