| 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 |