MCPcopy
hub / github.com/hyperopt/hyperopt / work

Method work

hyperopt/tests/unit/test_anneal.py:64–92  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

62 np.seterr(**self.olderr)
63
64 def work(self):
65 bandit = self.bandit
66 assert bandit.name is not None
67 algo = partial(anneal.suggest)
68 iters_thresholds = self.iters_thresholds.get(bandit.name, 50)
69
70 trials = Trials()
71 fmin(
72 fn=passthrough,
73 space=self.bandit.expr,
74 trials=trials,
75 algo=algo,
76 max_evals=iters_thresholds,
77 rstate=np.random.default_rng(8),
78 )
79 assert len(trials) == iters_thresholds
80
81 rtrials = Trials()
82 fmin(
83 fn=passthrough,
84 space=self.bandit.expr,
85 trials=rtrials,
86 algo=rand.suggest,
87 max_evals=iters_thresholds,
88 rstate=np.random.default_rng(8),
89 )
90
91 thresh = self.thresholds[bandit.name]
92 assert min(trials.losses()) < thresh

Callers

nothing calls this directly

Calls 5

lossesMethod · 0.95
TrialsClass · 0.90
fminFunction · 0.90
getMethod · 0.80
partialFunction · 0.50

Tested by

no test coverage detected