Class: HybridForest::Trees::LeafNode
- Inherits:
-
Object
- Object
- HybridForest::Trees::LeafNode
- Defined in:
- lib/hybridforest/trees/nodes/leaf_node.rb
Instance Method Summary collapse
- #classify(_instance) ⇒ Object
-
#initialize(instances) ⇒ LeafNode
constructor
A new instance of LeafNode.
- #print_string(spacing = "") ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(instances) ⇒ LeafNode
Returns a new instance of LeafNode.
6 7 8 |
# File 'lib/hybridforest/trees/nodes/leaf_node.rb', line 6 def initialize(instances) @prediction = majority_vote(instances) end |
Instance Method Details
#classify(_instance) ⇒ Object
10 11 12 |
# File 'lib/hybridforest/trees/nodes/leaf_node.rb', line 10 def classify(_instance) @prediction end |
#print_string(spacing = "") ⇒ Object
14 15 16 17 |
# File 'lib/hybridforest/trees/nodes/leaf_node.rb', line 14 def print_string(spacing = "") print spacing puts to_s end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/hybridforest/trees/nodes/leaf_node.rb', line 19 def to_s "Predict #{@prediction}" end |