MCPcopy Index your code
hub / github.com/hyperopt/hyperopt / test_seed_randomizes

Method test_seed_randomizes

hyperopt/tests/test_base.py:119–133  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

117 self.assertEqual(vals_1, vals_2)
118
119 def test_seed_randomizes(self):
120 #
121 # suggest() algorithms can be either stochastic (e.g. random search)
122 # or deterministic (e.g. grid search). If an suggest implementation
123 # is stochastic, then changing the seed argument should change the
124 # return value.
125 #
126 if not self.seed_randomizes:
127 return
128
129 # -- sample 20 points to make sure we get some differences even
130 # for small search spaces (chance of false failure is 1/million).
131 idxs_1, vals_1 = self.idxs_vals_from_ids(ids=list(range(20)), seed=45)
132 idxs_2, vals_2 = self.idxs_vals_from_ids(ids=list(range(20)), seed=46)
133 self.assertNotEqual((idxs_1, vals_1), (idxs_2, vals_2))
134
135
136class TestTrials(unittest.TestCase):

Callers

nothing calls this directly

Calls 1

idxs_vals_from_idsMethod · 0.95

Tested by

no test coverage detected