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

Method __init__

hyperopt/anneal.py:96–129  ·  view source on GitHub ↗

Parameters ---------- avg_best_idx: float Mean of geometric distribution over which trial to explore around, selecting from trials sorted by score (0 is best) shrink_coef: float Rate of reduction in the size of sampling neighborho

(self, domain, trials, seed, avg_best_idx=2.0, shrink_coef=0.1)

Source from the content-addressed store, hash-verified

94 """
95
96 def __init__(self, domain, trials, seed, avg_best_idx=2.0, shrink_coef=0.1):
97 """
98 Parameters
99 ----------
100 avg_best_idx: float
101 Mean of geometric distribution over which trial to explore around,
102 selecting from trials sorted by score (0 is best)
103
104 shrink_coef: float
105 Rate of reduction in the size of sampling neighborhood as more
106 points have been explored.
107 """
108 SuggestAlgo.__init__(self, domain, trials, seed=seed)
109 self.avg_best_idx = avg_best_idx
110 self.shrink_coef = shrink_coef
111 doc_by_tid = {}
112 for doc in trials.trials:
113 # get either this docs own tid or the one that it's from
114 tid = doc["tid"]
115 loss = domain.loss(doc["result"], doc["spec"])
116 # -- associate infinite loss to new/running/failed jobs
117 loss = float("inf" if loss is None else loss)
118 doc_by_tid[tid] = (doc, loss)
119 self.tid_docs_losses = sorted(doc_by_tid.items())
120 self.tids = np.asarray([t for (t, (d, l)) in self.tid_docs_losses])
121 self.losses = np.asarray([l for (t, (d, l)) in self.tid_docs_losses])
122 self.tid_losses_dct = dict(list(zip(self.tids, self.losses)))
123 # node_tids: dict from hp label -> trial ids (tids) using that hyperparam
124 # node_vals: dict from hp label -> values taken by that hyperparam
125 self.node_tids, self.node_vals = miscs_to_idxs_vals(
126 [d["misc"] for (tid, (d, l)) in self.tid_docs_losses],
127 keys=list(domain.params.keys()),
128 )
129 self.best_tids = []
130
131 def shrinking(self, label):
132 """Return fraction of original search width

Callers

nothing calls this directly

Calls 4

miscs_to_idxs_valsFunction · 0.85
lossMethod · 0.80
itemsMethod · 0.80
keysMethod · 0.80

Tested by

no test coverage detected