Class: BinaryDecisionTree::Tree
- Inherits:
-
Object
- Object
- BinaryDecisionTree::Tree
- Defined in:
- lib/binary_decision_tree/tree.rb
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
Instance Method Summary collapse
- #at(position) ⇒ Object
-
#initialize(depth, node_class: Node) ⇒ Tree
constructor
A new instance of Tree.
- #root ⇒ Object
- #size ⇒ Object
Constructor Details
Instance Attribute Details
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
3 4 5 |
# File 'lib/binary_decision_tree/tree.rb', line 3 def depth @depth end |
Instance Method Details
#at(position) ⇒ Object
14 15 16 |
# File 'lib/binary_decision_tree/tree.rb', line 14 def at(position) @nodes[position] end |
#root ⇒ Object
10 11 12 |
# File 'lib/binary_decision_tree/tree.rb', line 10 def root @nodes[1] end |
#size ⇒ Object
18 19 20 |
# File 'lib/binary_decision_tree/tree.rb', line 18 def size 2**depth end |