def build_idxs(self): for node in reversed(self.dfs_nodes): node_idxs = self.idxs_memo[node] if node.name == "one_of": n_options = len(node.pos_args) choices = scope.randint(n_options, size=scope.len(node_idxs)) self.choice_memo[node] = choices self.merge(node_idxs, choices) self.node_id[choices] = "node_%i" % len(self.node_id) sub_idxs = scope.vchoice_split(node_idxs, choices, n_options) for ii, arg in enumerate(node.pos_args): self.merge(sub_idxs[ii], arg) else: for arg in node.inputs(): self.merge(node_idxs, arg)
def hp_randint(label, *args, **kwargs): if not isinstance(label, basestring): raise TypeError("require string label") return scope.hyperopt_param(label, scope.randint(*args, **kwargs))
def hp_choice(label, options): if not isinstance(label, basestring): raise TypeError("require string label") ch = scope.hyperopt_param(label, scope.randint(len(options))) return scope.switch(ch, *options)
def hp_randint(label, *args, **kwargs): return scope.hyperopt_param(label, scope.randint(*args, **kwargs))
def hp_choice(label, options): ch = scope.hyperopt_param(label, scope.randint(len(options))) return scope.switch(ch, *options)
def hp_randint(label, *args, **kwargs): if not isinstance(label, basestring): raise TypeError('require string label') return scope.hyperopt_param(label, scope.randint(*args, **kwargs))
def hp_choice(label, options): if not isinstance(label, basestring): raise TypeError('require string label') ch = scope.hyperopt_param(label, scope.randint(len(options))) return scope.switch(ch, *options)