def config0(): p0 = scope.uniform(0, 1) p1 = scope.uniform(2, 3) p2 = scope.one_of(-1, p0) p3 = scope.one_of(-2, p1) p4 = 1 p5 = [3, 4, p0] d = locals() del d['p1'] # -- don't sample p1 all the time s = as_apply(d) return s
def config0(): p0 = scope.uniform(0, 1) p1 = scope.uniform(2, 3) p2 = scope.one_of(-1, p0) p3 = scope.one_of(-2, p1) p4 = 1 p5 = [3, 4, p0] p6 = scope.one_of(-3, p1) d = locals() d['p1'] = None # -- don't sample p1 all the time, only if p3 says so s = as_apply(d) return s
def test_repeatable(): u = scope.uniform(0, 1) aa = as_apply(dict(u=u, n=scope.normal(5, 0.1), l=[0, 1, scope.one_of(2, 3), u])) dd1 = sample(aa, np.random.RandomState(3)) dd2 = sample(aa, np.random.RandomState(3)) dd3 = sample(aa, np.random.RandomState(4)) assert dd1 == dd2 assert dd1 != dd3
def __init__(self): Base.__init__( self, dict( x=scope.uniform(-20, 20), hf=scope.one_of(dict(kind="raw"), dict(kind="negcos", amp=scope.uniform(0, 1))), ), )
def test_repeatable(): u = scope.uniform(0, 1) aa = as_apply( dict(u=u, n=scope.normal(5, 0.1), l=[0, 1, scope.one_of(2, 3), u])) dd1 = sample(aa, np.random.RandomState(3)) dd2 = sample(aa, np.random.RandomState(3)) dd3 = sample(aa, np.random.RandomState(4)) assert dd1 == dd2 assert dd1 != dd3
def test_sample(): u = scope.uniform(0, 1) aa = as_apply(dict(u=u, n=scope.normal(5, 0.1), l=[0, 1, scope.one_of(2, 3), u])) print aa dd = sample(aa, np.random.RandomState(3)) assert 0 < dd["u"] < 1 assert 4 < dd["n"] < 6 assert dd["u"] == dd["l"][3] assert dd["l"][:2] == (0, 1) assert dd["l"][2] in (2, 3)
def test_sample(): u = scope.uniform(0, 1) aa = as_apply( dict(u=u, n=scope.normal(5, 0.1), l=[0, 1, scope.one_of(2, 3), u])) print aa dd = sample(aa, np.random.RandomState(3)) assert 0 < dd['u'] < 1 assert 4 < dd['n'] < 6 assert dd['u'] == dd['l'][3] assert dd['l'][:2] == (0, 1) assert dd['l'][2] in (2, 3)
def __init__(self, n_features=None): # if n-features is given, it will set the number of filters # in the top-most layer self.comparison = scope.one_of('mult', 'sqrtabsdiff') template = dict( model=model_params.pyll_param_func(n_features), comparison=self.comparison, decisions=None, # XXX SVM STUFF? ) hyperopt.Bandit.__init__(self, template)
def __init__(self): Bandit.__init__(self, dict(flip=scope.one_of('heads', 'tails')))
def __init__(self): Base.__init__(self, dict(x=scope.one_of(0, 1)))
def __init__(self): Base.__init__(self, dict(curve=scope.one_of(0, 1), x=scope.uniform(-20, 20)))