本文整理汇总了Python中HPOlibConfigSpace.configuration_space.ConfigurationSpace.add_hyperparameter方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationSpace.add_hyperparameter方法的具体用法?Python ConfigurationSpace.add_hyperparameter怎么用?Python ConfigurationSpace.add_hyperparameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HPOlibConfigSpace.configuration_space.ConfigurationSpace
的用法示例。
在下文中一共展示了ConfigurationSpace.add_hyperparameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_hyperparameter_search_space
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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
示例2: test_add_forbidden
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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)
示例3: get_hyperparameter_search_space
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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_write_log10
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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)
示例6: test_write_q_float
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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)
示例7: test_write_q_int
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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)
示例8: get_hyperparameter_search_space
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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
示例9: get_hyperparameter_search_space
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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
示例10: test_add_hyperparameters_with_equal_names
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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)
示例11: get_hyperparameter_search_space
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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
示例12: test_hyperparameters_with_valid_condition
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
def test_hyperparameters_with_valid_condition(self):
cs = ConfigurationSpace()
hp1 = CategoricalHyperparameter("parent", [0, 1])
cs.add_hyperparameter(hp1)
hp2 = UniformIntegerHyperparameter("child", 0, 10)
cs.add_hyperparameter(hp2)
cond = EqualsCondition(hp2, hp1, 0)
cs.add_condition(cond)
self.assertEqual(len(cs._hyperparameters), 2)
示例13: get_hyperparameter_search_space
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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
示例14: get_hyperparameter_search_space
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
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
示例15: test_get_conditions
# 需要导入模块: from HPOlibConfigSpace.configuration_space import ConfigurationSpace [as 别名]
# 或者: from HPOlibConfigSpace.configuration_space.ConfigurationSpace import add_hyperparameter [as 别名]
def test_get_conditions(self):
cs = ConfigurationSpace()
hp1 = CategoricalHyperparameter("parent", [0, 1])
cs.add_hyperparameter(hp1)
hp2 = UniformIntegerHyperparameter("child", 0, 10)
cs.add_hyperparameter(hp2)
self.assertEqual([], cs.get_conditions())
cond1 = EqualsCondition(hp2, hp1, 0)
cs.add_condition(cond1)
self.assertEqual([cond1], cs.get_conditions())