Class: Classbench::ClassbenchStats
- Inherits:
-
Object
- Object
- Classbench::ClassbenchStats
- Defined in:
- lib/classbench/trie.rb
Overview
Structure representing trie statistics proposed in the ClassBench tool.
Array members store statistics defined separately for each level of the trie. Prefix nesting is defined for the whole trie.
Instance Attribute Summary collapse
-
#branching_one_child ⇒ Object
(float[]) probability of node with only one child (from all non-leaf nodes),.
-
#branching_two_children ⇒ Object
(float[]) probability of node with two children (from all non-leaf nodes).
-
#prefix_lengths ⇒ Object
(float[]) number of prefixes (not prefix nodes) with given length.
-
#prefix_nesting ⇒ Object
(int) maximum number of prefix nodes on an arbitrary path in the trie.
-
#skew ⇒ Object
(float[]) average relative weight ratio of lighter vs heavier subtree (nodes with two children only).
Instance Method Summary collapse
-
#initialize ⇒ ClassbenchStats
constructor
A new instance of ClassbenchStats.
Constructor Details
#initialize ⇒ ClassbenchStats
Returns a new instance of ClassbenchStats.
24 25 26 27 28 29 30 31 32 |
# File 'lib/classbench/trie.rb', line 24 def initialize preinitialized_hash = Hash[*(0..DEFAULT_DEPTH).flat_map { |k, v| [k , 0.0] }] self.prefix_lengths = preinitialized_hash.dup self.branching_one_child = preinitialized_hash.dup self.branching_two_children = preinitialized_hash.dup self.skew = preinitialized_hash.dup self.prefix_nesting = 0 end |
Instance Attribute Details
#branching_one_child ⇒ Object
(float[]) probability of node with only one child (from all non-leaf nodes),
13 14 15 |
# File 'lib/classbench/trie.rb', line 13 def branching_one_child @branching_one_child end |
#branching_two_children ⇒ Object
(float[]) probability of node with two children (from all non-leaf nodes)
16 17 18 |
# File 'lib/classbench/trie.rb', line 16 def branching_two_children @branching_two_children end |
#prefix_lengths ⇒ Object
(float[]) number of prefixes (not prefix nodes) with given length
10 11 12 |
# File 'lib/classbench/trie.rb', line 10 def prefix_lengths @prefix_lengths end |
#prefix_nesting ⇒ Object
(int) maximum number of prefix nodes on an arbitrary path in the trie
22 23 24 |
# File 'lib/classbench/trie.rb', line 22 def prefix_nesting @prefix_nesting end |
#skew ⇒ Object
(float[]) average relative weight ratio of lighter vs heavier subtree (nodes with two children only)
19 20 21 |
# File 'lib/classbench/trie.rb', line 19 def skew @skew end |