autora.theorist.bsr.node
Node
Source code in temp_dir/bsr/src/autora/theorist/bsr/node.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 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 99 100 101 102 103 104 105 106 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 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
__str__()
Get a literal (string) representation of a tree node
data structure.
See get_expression
for more information.
Source code in temp_dir/bsr/src/autora/theorist/bsr/node.py
173 174 175 176 177 178 |
|
evaluate(X, store_result=False)
Evaluate the expression, as represented by an expression tree with self
as the root,
using the given data matrix X
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X
|
Union[ndarray, DataFrame]
|
the data matrix with each row being a data point and each column a feature |
required |
store_result
|
bool
|
whether to store the result of this calculation |
False
|
Return
result: the result of this calculation
Source code in temp_dir/bsr/src/autora/theorist/bsr/node.py
99 100 101 102 103 104 105 106 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 |
|
get_expression(ops_expr=None, feature_names=None)
Get a literal (string) expression of the expression tree
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ops_expr
|
Optional[Dict[str, str]]
|
the dictionary that maps an operation name to its literal format; if not
offered, use the default one in |
None
|
feature_names
|
Optional[List[str]]
|
the list of names for the data features |
None
|
Return: a literal expression of the tree
Source code in temp_dir/bsr/src/autora/theorist/bsr/node.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
setup(op_name='', ops_prior={}, feature=0, **hyper_params)
Initialize an uninitialized node with given feature, in the case of a leaf node, or some given operator information, in the case of unary or binary node. The type of the node is determined by the feature/operator assigned to it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
op_name
|
str
|
the operator name, if given |
''
|
ops_prior
|
Dict
|
the prior dictionary of the given operator |
{}
|
feature
|
int
|
the index of the assigned feature, if given |
0
|
hyper_params
|
hyperparameters for initializing the node |
{}
|
Source code in temp_dir/bsr/src/autora/theorist/bsr/node.py
62 63 64 65 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 |
|
NodeType
Bases: Enum
-1 represents newly grown node (not decided yet) 0 represents no child, as a terminal node 1 represents one child, 2 represents 2 children
Source code in temp_dir/bsr/src/autora/theorist/bsr/node.py
10 11 12 13 14 15 16 17 18 19 20 21 |
|