本文整理汇总了Python中ConfigSpace.ConfigurationSpace.get_parent_conditions_of方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationSpace.get_parent_conditions_of方法的具体用法?Python ConfigurationSpace.get_parent_conditions_of怎么用?Python ConfigurationSpace.get_parent_conditions_of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigSpace.ConfigurationSpace
的用法示例。
在下文中一共展示了ConfigurationSpace.get_parent_conditions_of方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_parent_and_chil_conditions_of
# 需要导入模块: from ConfigSpace import ConfigurationSpace [as 别名]
# 或者: from ConfigSpace.ConfigurationSpace import get_parent_conditions_of [as 别名]
def test_get_parent_and_chil_conditions_of(self):
cs = ConfigurationSpace()
hp1 = CategoricalHyperparameter("parent", [0, 1])
cs.add_hyperparameter(hp1)
hp2 = UniformIntegerHyperparameter("child", 0, 10)
cs.add_hyperparameter(hp2)
cond1 = EqualsCondition(hp2, hp1, 0)
cs.add_condition(cond1)
self.assertEqual([cond1], cs.get_parent_conditions_of(hp2.name))
self.assertEqual([cond1], cs.get_parent_conditions_of(hp2))
self.assertEqual([cond1], cs.get_child_conditions_of(hp1.name))
self.assertEqual([cond1], cs.get_child_conditions_of(hp1))
self.assertRaisesRegex(KeyError,
"Hyperparameter 'Foo' does not exist in this "
"configuration space.", cs.get_parents_of,
"Foo")
self.assertRaisesRegex(KeyError,
"Hyperparameter 'Foo' does not exist in this "
"configuration space.", cs.get_children_of,
"Foo")