Class: Liblinear::FeatureNodeMatrix
- Inherits:
-
Object
- Object
- Liblinear::FeatureNodeMatrix
- Defined in:
- lib/liblinear/feature_node_matrix.rb
Instance Method Summary collapse
- #delete ⇒ Object
-
#initialize(examples, bias) ⇒ FeatureNodeMatrix
constructor
A new instance of FeatureNodeMatrix.
- #swig ⇒ SWIG::TYPE_p_p_feature_node
Constructor Details
#initialize(examples, bias) ⇒ FeatureNodeMatrix
Returns a new instance of FeatureNodeMatrix.
5 6 7 8 9 10 11 12 |
# File 'lib/liblinear/feature_node_matrix.rb', line 5 def initialize(examples, bias) @feature_node_matrix = Liblinearswig.feature_node_matrix(examples.size) max_feature_id = Liblinear::Example.max_feature_id(examples) examples.size.times do |index| feature_node = Liblinear::FeatureNode.new(examples[index], max_feature_id, bias) Liblinearswig.feature_node_matrix_set(@feature_node_matrix, index, feature_node.swig) end end |
Instance Method Details
#delete ⇒ Object
19 20 21 |
# File 'lib/liblinear/feature_node_matrix.rb', line 19 def delete Liblinearswig.feature_node_matrix_destroy(@feature_node_matrix) end |
#swig ⇒ SWIG::TYPE_p_p_feature_node
15 16 17 |
# File 'lib/liblinear/feature_node_matrix.rb', line 15 def swig @feature_node_matrix end |