MCPcopy
hub / github.com/hyperopt/hyperopt / __init__

Method __init__

hyperopt/vectorize.py:220–242  ·  view source on GitHub ↗
(self, expr, expr_idxs, build=True)

Source from the content-addressed store, hash-verified

218 """
219
220 def __init__(self, expr, expr_idxs, build=True):
221 self.expr = expr
222 self.expr_idxs = expr_idxs
223 self.dfs_nodes = dfs(expr)
224 self.params = {}
225 for ii, node in enumerate(self.dfs_nodes):
226 if node.name == "hyperopt_param":
227 label = node.arg["label"].obj
228 self.params[label] = node.arg["obj"]
229 # -- recursive construction
230 # This makes one term in each idxs, vals memo for every
231 # directed path through the switches in the graph.
232
233 self.idxs_memo = {} # node -> union, all idxs computed
234 self.take_memo = {} # node -> list of idxs_take retrieving node vals
235 self.v_expr = self.build_idxs_vals(expr, expr_idxs)
236
237 # TODO: graph-optimization pass to remove cruft:
238 # - unions of 1
239 # - unions of full sets with their subsets
240 # - idxs_take that can be merged
241
242 self.assert_integrity_idxs_take()
243
244 def assert_integrity_idxs_take(self):
245 idxs_memo = self.idxs_memo

Callers

nothing calls this directly

Calls 3

build_idxs_valsMethod · 0.95
dfsFunction · 0.85

Tested by

no test coverage detected