effector.tree
Summary
The Tree
classes provide a way to construct and manage a hierarchical tree structure.
The subregions detected per feature are stored in a Tree
object.
API Reference
effector.tree.Tree()
A class to represent a tree structure.
Methods:
Name | Description |
---|---|
show_full_tree |
Print the full tree structure. |
show_level_stats |
Print the heterogeneity drop at each level of the tree. |
Source code in effector/tree.py
7 8 9 10 |
|
show_full_tree(scale_x_list=None)
Print the full tree structure.
Examples:
>>> tree.show_full_tree()
π³ Full Tree Structure:
βββββββββββββββββββββββ
x1 πΉ [id: 0 | heter: 0.50 | inst: 100 | w: 1.00]
x2 β₯ 3.00 πΉ [id: 1 | heter: 0.30 | inst: 50 | w: 0.50]
x2 < 3.00 πΉ [id: 2 | heter: 0.20 | inst: 50 | w: 0.50]
>>> tree.show_full_tree({"mean": 3, "std":2}, {"mean": 3, "std":3}, {"mean": 3, "std":2})
π³ Full Tree Structure:
βββββββββββββββββββββββ
x1 πΉ [id: 0 | heter: 0.50 | inst: 100 | w: 1.00]
x2 β₯ 12.00 πΉ [id: 1 | heter: 0.30 | inst: 50 | w: 0.50]
x2 < 12.00 πΉ [id: 2 | heter: 0.20 | inst: 50 | w: 0.50]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scale_x_list
|
A list of dictionaries with the mean and standard deviation for each feature. - Example: [{"mean": 3, "std":2}, {"mean": 3, "std":2}, ...] |
None
|
Source code in effector/tree.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
show_level_stats()
Print the heterogeneity drop at each level of the tree.
Examples:
>>> tree.show_level_stats()
π³ Tree Summary:
βββββββββββββββββ
Level 0πΉheter: 0.50
Level 1πΉheter: 0.25 | π»0.25 (50.00%)
Source code in effector/tree.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|