本文整理汇总了Python中autosklearn.pipeline.classification.SimpleClassificationPipeline.get_hyperparameter方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleClassificationPipeline.get_hyperparameter方法的具体用法?Python SimpleClassificationPipeline.get_hyperparameter怎么用?Python SimpleClassificationPipeline.get_hyperparameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autosklearn.pipeline.classification.SimpleClassificationPipeline
的用法示例。
在下文中一共展示了SimpleClassificationPipeline.get_hyperparameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_hyperparameter_search_space_preprocessor_contradicts_default_classifier
# 需要导入模块: from autosklearn.pipeline.classification import SimpleClassificationPipeline [as 别名]
# 或者: from autosklearn.pipeline.classification.SimpleClassificationPipeline import get_hyperparameter [as 别名]
def test_get_hyperparameter_search_space_preprocessor_contradicts_default_classifier(self):
cs = SimpleClassificationPipeline(
include={'preprocessor': ['densifier']}, dataset_properties={'sparse': True}).\
get_hyperparameter_search_space()
self.assertEqual(cs.get_hyperparameter(
'classifier:__choice__').default_value,
'qda'
)
cs = SimpleClassificationPipeline(include={'preprocessor': ['nystroem_sampler']}).\
get_hyperparameter_search_space()
self.assertEqual(cs.get_hyperparameter(
'classifier:__choice__').default_value,
'sgd'
)
示例2: test_get_hyperparameter_search_space_include_exclude_models
# 需要导入模块: from autosklearn.pipeline.classification import SimpleClassificationPipeline [as 别名]
# 或者: from autosklearn.pipeline.classification.SimpleClassificationPipeline import get_hyperparameter [as 别名]
def test_get_hyperparameter_search_space_include_exclude_models(self):
cs = SimpleClassificationPipeline(include={'classifier': ['libsvm_svc']})\
.get_hyperparameter_search_space()
self.assertEqual(cs.get_hyperparameter('classifier:__choice__'),
CategoricalHyperparameter('classifier:__choice__', ['libsvm_svc']))
cs = SimpleClassificationPipeline(exclude={'classifier': ['libsvm_svc']}).\
get_hyperparameter_search_space()
self.assertNotIn('libsvm_svc', str(cs))
cs = SimpleClassificationPipeline(
include={'preprocessor': ['select_percentile_classification']}).\
get_hyperparameter_search_space()
self.assertEqual(cs.get_hyperparameter('preprocessor:__choice__'),
CategoricalHyperparameter('preprocessor:__choice__',
['select_percentile_classification']))
cs = SimpleClassificationPipeline(
exclude={'preprocessor': ['select_percentile_classification']}
).get_hyperparameter_search_space()
self.assertNotIn('select_percentile_classification', str(cs))
示例3: test_get_hyperparameter_search_space
# 需要导入模块: from autosklearn.pipeline.classification import SimpleClassificationPipeline [as 别名]
# 或者: from autosklearn.pipeline.classification.SimpleClassificationPipeline import get_hyperparameter [as 别名]
def test_get_hyperparameter_search_space(self):
cs = SimpleClassificationPipeline().get_hyperparameter_search_space()
self.assertIsInstance(cs, ConfigurationSpace)
conditions = cs.get_conditions()
self.assertEqual(len(cs.get_hyperparameter(
'rescaling:__choice__').choices), 6)
self.assertEqual(len(cs.get_hyperparameter(
'classifier:__choice__').choices), 16)
self.assertEqual(len(cs.get_hyperparameter(
'preprocessor:__choice__').choices), 13)
hyperparameters = cs.get_hyperparameters()
self.assertEqual(172, len(hyperparameters))
#for hp in sorted([str(h) for h in hyperparameters]):
# print hp
# The four parameters which are always active are classifier,
# preprocessor, imputation strategy and scaling strategy
self.assertEqual(len(hyperparameters) - 6, len(conditions))