Class: HexWrench::NominalFeature

Inherits:
Feature
  • Object
show all
Defined in:
lib/hexwrench/core/feature.rb,
lib/hexwrench/weka/feature.rb

Instance Attribute Summary collapse

Attributes inherited from Feature

#resource, #sym

Instance Method Summary collapse

Methods inherited from Feature

for, mapping

Constructor Details

#initialize(sym, resource, labels = []) ⇒ NominalFeature

Returns a new instance of NominalFeature.



44
45
46
47
# File 'lib/hexwrench/core/feature.rb', line 44

def initialize(sym, resource, labels = [])
  super(sym, resource)
  @allowed_labels = labels
end

Instance Attribute Details

#allowed_labelsObject

Returns the value of attribute allowed_labels.



43
44
45
# File 'lib/hexwrench/core/feature.rb', line 43

def allowed_labels
  @allowed_labels
end

Instance Method Details

#labels_fvObject



14
15
16
17
18
19
20
# File 'lib/hexwrench/weka/feature.rb', line 14

def labels_fv
  unless @labels_fv
    @labels_fv = Weka::FastVector.new
    allowed_labels.each{|l| @labels_fv.add_element(l.to_s)}
  end
  @labels_fv
end