Class: Basset::FeatureSelector::FeatureValues
- Inherits:
-
Object
- Object
- Basset::FeatureSelector::FeatureValues
- Defined in:
- lib/basset/feature_selector.rb
Overview
A class to hold the values associated with a feature. These values are important for feature selection.
Instance Attribute Summary collapse
-
#docs_with_feature ⇒ Object
Returns the value of attribute docs_with_feature.
Instance Method Summary collapse
- #add_document_with_class(classification) ⇒ Object
- #docs_with_class(classification) ⇒ Object
-
#initialize ⇒ FeatureValues
constructor
A new instance of FeatureValues.
Constructor Details
#initialize ⇒ FeatureValues
Returns a new instance of FeatureValues.
109 110 111 112 |
# File 'lib/basset/feature_selector.rb', line 109 def initialize() @classes = Hash.new(0) @docs_with_feature = 0 end |
Instance Attribute Details
#docs_with_feature ⇒ Object
Returns the value of attribute docs_with_feature.
107 108 109 |
# File 'lib/basset/feature_selector.rb', line 107 def docs_with_feature @docs_with_feature end |
Instance Method Details
#add_document_with_class(classification) ⇒ Object
114 115 116 117 |
# File 'lib/basset/feature_selector.rb', line 114 def add_document_with_class(classification) @classes[classification] += 1 @docs_with_feature += 1 end |
#docs_with_class(classification) ⇒ Object
119 120 121 |
# File 'lib/basset/feature_selector.rb', line 119 def docs_with_class(classification) @classes[classification] end |