本文整理汇总了Python中HPOlibConfigSpace.configuration_space.ConfigurationSpace类的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationSpace类的具体用法?Python ConfigurationSpace怎么用?Python ConfigurationSpace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigurationSpace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_hyperparameter_search_space
def get_hyperparameter_search_space(dataset_properties=None):
cs = ConfigurationSpace()
C = cs.add_hyperparameter(UniformFloatHyperparameter(
"C", 0.03125, 32768, log=True, default=1.0))
loss = cs.add_hyperparameter(CategoricalHyperparameter(
"loss", ["epsilon_insensitive", "squared_epsilon_insensitive"],
default="squared_epsilon_insensitive"))
# Random Guess
epsilon = cs.add_hyperparameter(UniformFloatHyperparameter(
name="epsilon", lower=0.001, upper=1, default=0.1, log=True))
dual = cs.add_hyperparameter(Constant("dual", "False"))
# These are set ad-hoc
tol = cs.add_hyperparameter(UniformFloatHyperparameter(
"tol", 1e-5, 1e-1, default=1e-4, log=True))
fit_intercept = cs.add_hyperparameter(Constant("fit_intercept", "True"))
intercept_scaling = cs.add_hyperparameter(Constant(
"intercept_scaling", 1))
dual_and_loss = ForbiddenAndConjunction(
ForbiddenEqualsClause(dual, "False"),
ForbiddenEqualsClause(loss, "epsilon_insensitive")
)
cs.add_forbidden_clause(dual_and_loss)
return cs
示例2: get_hyperparameter_search_space
def get_hyperparameter_search_space(dataset_properties=None):
keep_variance = UniformFloatHyperparameter("keep_variance", 0.5, 0.9999, default=0.9999)
whiten = CategoricalHyperparameter("whiten", ["False", "True"], default="False")
cs = ConfigurationSpace()
cs.add_hyperparameter(keep_variance)
cs.add_hyperparameter(whiten)
return cs
示例3: get_hyperparameter_search_space
def get_hyperparameter_search_space(dataset_properties=None):
# TODO add replace by zero!
strategy = CategoricalHyperparameter(
"strategy", ["mean", "median", "most_frequent"], default="mean")
cs = ConfigurationSpace()
cs.add_hyperparameter(strategy)
return cs
示例4: get_hyperparameter_search_space
def get_hyperparameter_search_space(dataset_properties=None):
# TODO add replace by zero!
strategy = CategoricalHyperparameter(
"strategy", ["none", "weighting"], default="none")
cs = ConfigurationSpace()
cs.add_hyperparameter(strategy)
return cs
示例5: test_add_forbidden
def test_add_forbidden(self):
m = numpy.ones([2, 3])
preprocessors_list = ['pa', 'pb']
classifier_list = ['ca', 'cb', 'cc']
cs = ConfigurationSpace()
preprocessor = CategoricalHyperparameter(name='preprocessor',
choices=preprocessors_list)
classifier = CategoricalHyperparameter(name='classifier',
choices=classifier_list)
cs.add_hyperparameter(preprocessor)
cs.add_hyperparameter(classifier)
new_cs = autosklearn.pipeline.create_searchspace_util.add_forbidden(
conf_space=cs, node_0_list=preprocessors_list,
node_1_list=classifier_list, matches=m,
node_0_name='preprocessor', node_1_name="classifier")
self.assertEqual(len(new_cs.forbidden_clauses), 0)
self.assertIsInstance(new_cs, ConfigurationSpace)
m[1, 1] = 0
new_cs = autosklearn.pipeline.create_searchspace_util.add_forbidden(
conf_space=cs, node_0_list=preprocessors_list,
node_1_list=classifier_list, matches=m,
node_0_name='preprocessor', node_1_name="classifier")
self.assertEqual(len(new_cs.forbidden_clauses), 1)
self.assertEqual(new_cs.forbidden_clauses[0].components[0].value, 'cb')
self.assertEqual(new_cs.forbidden_clauses[0].components[1].value, 'pb')
self.assertIsInstance(new_cs, ConfigurationSpace)
示例6: test_write_log10
def test_write_log10(self):
expected = "a [10.0, 1000.0] [100.0]l"
cs = ConfigurationSpace()
cs.add_hyperparameter(
UniformFloatHyperparameter("a", 10, 1000, log=True))
value = pcs_parser.write(cs)
self.assertEqual(expected, value)
示例7: test_write_q_float
def test_write_q_float(self):
expected = "Q16_float_a [16.0, 1024.0] [520.0]"
cs = ConfigurationSpace()
cs.add_hyperparameter(
UniformFloatHyperparameter("float_a", 16, 1024, q=16))
value = pcs_parser.write(cs)
self.assertEqual(expected, value)
示例8: test_write_q_int
def test_write_q_int(self):
expected = "Q16_int_a [16, 1024] [520]i"
cs = ConfigurationSpace()
cs.add_hyperparameter(
UniformIntegerHyperparameter("int_a", 16, 1024, q=16))
value = pcs_parser.write(cs)
self.assertEqual(expected, value)
示例9: get_hyperparameter_search_space
def get_hyperparameter_search_space(dataset_properties=None):
N = UniformIntegerHyperparameter("N", 5, 20, default=10)
precond = UniformFloatHyperparameter("precond", 0, 0.5, default=0.1)
cs = ConfigurationSpace()
cs.add_hyperparameter(N)
cs.add_hyperparameter(precond)
return cs
示例10: get_hyperparameter_search_space
def get_hyperparameter_search_space(dataset_properties=None):
gamma = UniformFloatHyperparameter("gamma", 0.3, 2.0, default=1.0)
n_components = UniformIntegerHyperparameter("n_components", 50, 10000, default=100, log=True)
cs = ConfigurationSpace()
cs.add_hyperparameter(gamma)
cs.add_hyperparameter(n_components)
return cs
示例11: test_add_hyperparameters_with_equal_names
def test_add_hyperparameters_with_equal_names(self):
cs = ConfigurationSpace()
hp = UniformIntegerHyperparameter("name", 0, 10)
cs.add_hyperparameter(hp)
self.assertRaisesRegexp(ValueError,
"Hyperparameter 'name' is already in the "
"configuration space.",
cs.add_hyperparameter, hp)
示例12: get_hyperparameter_search_space
def get_hyperparameter_search_space(dataset_properties=None):
cs = ConfigurationSpace()
use_minimum_fraction = cs.add_hyperparameter(CategoricalHyperparameter(
"use_minimum_fraction", ["True", "False"], default="True"))
minimum_fraction = cs.add_hyperparameter(UniformFloatHyperparameter(
"minimum_fraction", lower=.0001, upper=0.5, default=0.01, log=True))
cs.add_condition(EqualsCondition(minimum_fraction,
use_minimum_fraction, 'True'))
return cs
示例13: get_hyperparameter_search_space
def get_hyperparameter_search_space(dataset_properties=None):
cs = ConfigurationSpace()
alpha = cs.add_hyperparameter(UniformFloatHyperparameter(
"alpha", 10 ** -5, 10., log=True, default=1.))
fit_intercept = cs.add_hyperparameter(UnParametrizedHyperparameter(
"fit_intercept", "True"))
tol = cs.add_hyperparameter(UniformFloatHyperparameter(
"tol", 1e-5, 1e-1, default=1e-4, log=True))
return cs
示例14: get_hyperparameter_search_space
def get_hyperparameter_search_space(dataset_properties=None):
percentile = UniformFloatHyperparameter("percentile", lower=1, upper=99, default=50)
score_func = UnParametrizedHyperparameter(name="score_func", value="f_regression")
cs = ConfigurationSpace()
cs.add_hyperparameter(percentile)
cs.add_hyperparameter(score_func)
return cs
示例15: get_hyperparameter_search_space
def get_hyperparameter_search_space(dataset_properties=None):
cs = ConfigurationSpace()
n_iter = cs.add_hyperparameter(
UnParametrizedHyperparameter("n_iter", value=300))
tol = cs.add_hyperparameter(
UniformFloatHyperparameter("tol", 10 ** -5, 10 ** -1,
default=10 ** -4, log=True))
alpha_1 = cs.add_hyperparameter(
UniformFloatHyperparameter(name="alpha_1", lower=10 ** -10,
upper=10 ** -3, default=10 ** -6))
alpha_2 = cs.add_hyperparameter(
UniformFloatHyperparameter(name="alpha_2", log=True,
lower=10 ** -10, upper=10 ** -3,
default=10 ** -6))
lambda_1 = cs.add_hyperparameter(
UniformFloatHyperparameter(name="lambda_1", log=True,
lower=10 ** -10, upper=10 ** -3,
default=10 ** -6))
lambda_2 = cs.add_hyperparameter(
UniformFloatHyperparameter(name="lambda_2", log=True,
lower=10 ** -10, upper=10 ** -3,
default=10 ** -6))
threshold_lambda = cs.add_hyperparameter(
UniformFloatHyperparameter(name="threshold_lambda",
log=True,
lower=10 ** 3,
upper=10 ** 5,
default=10 ** 4))
fit_intercept = cs.add_hyperparameter(UnParametrizedHyperparameter(
"fit_intercept", "True"))
return cs