Esempio n. 1
0
 def read_normal(self, expr, label, condition=None):
     assert len(expr.inputs()) == 2
     assert all([input.name == "literal" for input in expr.inputs()]), \
         expr.inputs()
     mu = expr.inputs()[0]._obj
     sigma = expr.inputs()[1]._obj
     return configuration_space_module.NormalFloatHyperparameter(
         label, mu, sigma)
Esempio n. 2
0
 def read_lognormal(self, expr, label, condition=None):
     # Returns a value drawn according to exp(normal(mu, sigma))
     assert len(expr.inputs()) == 2
     assert all([input.name == "literal" for input in expr.inputs()]), \
         expr.inputs()
     mu = expr.inputs()[0]._obj
     sigma = expr.inputs()[1]._obj
     return configuration_space_module.NormalFloatHyperparameter(label,
                                                                 mu,
                                                                 sigma,
                                                                 base=np.e)
Esempio n. 3
0
 def read_qlognormal(self, expr, label, condition=None):
     # Returns a value like round(exp(normal(mu, sigma)) / q) * q
     assert len(expr.inputs()) == 3
     assert all([input.name == "literal" for input in expr.inputs()]), \
         expr.inputs()
     mu = expr.inputs()[0]._obj
     sigma = expr.inputs()[1]._obj
     q = expr.inputs()[2]._obj
     if abs(q - 1.0) < 0.0001:
         return configuration_space_module.NormalIntegerHyperparameter(
             label, mu, sigma, base=np.e)
     else:
         return configuration_space_module.NormalFloatHyperparameter(
             label, mu, sigma, q=q, base=np.e)
Esempio n. 4
0
 def read_qnormal(self, expr, label, condition=None):
     assert len(expr.inputs()) == 3
     assert all([input.name == "literal" for input in expr.inputs()]), \
         expr.inputs()
     mu = expr.inputs()[0]._obj
     sigma = expr.inputs()[1]._obj
     q = expr.inputs()[2]._obj
     if abs(q - 1.0) < 0.0001:
         return configuration_space_module.NormalIntegerHyperparameter(
             label, mu, sigma)
     else:
         return configuration_space_module.NormalFloatHyperparameter(label,
                                                                     mu,
                                                                     sigma,
                                                                     q=q)