MCPcopy
hub / github.com/hyperopt/hyperopt / test_sample

Function test_sample

hyperopt/pyll/tests/test_stochastic.py:63–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61
62
63def test_sample():
64 u = scope.uniform(0, 1)
65 aa = as_apply(dict(u=u, n=scope.normal(5, 0.1), l=[0, 1, scope.one_of(2, 3), u]))
66 print(aa)
67 dd = sample(aa, np.random.default_rng(3))
68 assert 0 < dd["u"] < 1
69 assert 4 < dd["n"] < 6
70 assert dd["u"] == dd["l"][3]
71 assert dd["l"][:2] == (0, 1)
72 assert dd["l"][2] in (2, 3)

Callers

nothing calls this directly

Calls 2

as_applyFunction · 0.90
sampleFunction · 0.90

Tested by

no test coverage detected