def test_wrong_number_of_required_interfaces(self):
     component = SearchSpaceComponent(description)
     instance = SearchSpaceComponentInstance(component)
     assert not instance.set_required_interfaces({})
     assert not instance.set_required_interfaces(
         {
             "estimator": ExtraTreesClassifier(),
             "additional": ExtraTreesClassifier(),
         })
 def test_pipeline_element_construction(self):
     component = SearchSpaceComponent(description)
     instance = SearchSpaceComponentInstance(component)
     assert instance.set_parameter_config({"step": 0.3})
     estimator = ExtraTreesClassifier()
     assert instance.set_required_interfaces({"estimator": estimator})
     pipeline_element = instance.construct_pipeline_element()
     assert isinstance(pipeline_element, RFE)
     assert pipeline_element.get_params(deep=False) == {
         "step": 0.3,
         "estimator": estimator,
         "n_features_to_select": None,
         "verbose": 0,
     }
 def test_pipeline_element_construction_withput_interfaces(self):
     component = SearchSpaceComponent(description)
     instance = SearchSpaceComponentInstance(component)
     assert instance.set_parameter_config({"step": 0.3})
     assert instance.construct_pipeline_element() is None
 def test_pipeline_element_construction_without_params(self):
     component = SearchSpaceComponent(description)
     instance = SearchSpaceComponentInstance(component)
     estimator = ExtraTreesClassifier()
     assert instance.set_required_interfaces({"estimator": estimator})
     assert instance.construct_pipeline_element() is None
 def test_wrong_required_interfaces(self):
     component = SearchSpaceComponent(description)
     instance = SearchSpaceComponentInstance(component)
     assert not instance.set_required_interfaces({})
 def test_missing_required_interfaces(self):
     component = SearchSpaceComponent(description)
     instance = SearchSpaceComponentInstance(component)
     assert not instance.set_required_interfaces(
         {"wrong": ExtraTreesClassifier()})
 def test_invalid_parameter_configuration(self):
     component = SearchSpaceComponent(description)
     instance = SearchSpaceComponentInstance(component)
     assert not instance.set_parameter_config({"step": 0.01})
 def test_instance_construction(self):
     component = SearchSpaceComponent(description)
     instance = SearchSpaceComponentInstance(component)
     assert instance.get_component() == component
 def test_pipeline_element_construction_with_wrong_path(self):
     component = SearchSpaceComponent(description_with_wrong_path)
     instance = SearchSpaceComponentInstance(component)
     assert instance.construct_pipeline_element() is None
Beispiel #10
0
 SearchSpaceComponent({
     "name":
     "testComponent",
     "providedInterface": ["providedA", "providedB", "providedC"],
     "requiredInterface": [
         {
             "id": "required1",
             "name": "requiredA",
             "construction_key": "key_a",
         },
         {
             "id": "required2",
             "name": "requiredB",
             "construction_key": 2,
         },
         {
             "id": "required3",
             "name": "requiredC",
             "construction_key": "key_b",
         },
     ],
     "parameter": [
         {
             "name": "testDouble",
             "type": "double",
             "default": 0.53,
             "min": 0.05,
             "max": 1.01,
             "construction_key": 1,
         },
         {
             "name": "testInt",
             "type": "int",
             "default": 6,
             "min": 1,
             "max": 11,
             "construction_key": 0,
         },
         {
             "name": "testCat",
             "default": "a",
             "type": "cat",
             "values": ["a", "b", "c"],
             "construction_key": "key_c",
         },
     ],
 }),
Beispiel #11
0
    SearchSpaceComponent, )

component_mapping = {
    "vars":
    SearchSpaceComponent({
        "name":
        "testComponent",
        "providedInterface": [],
        "requiredInterface": [],
        "parameter": [
            {
                "name": "x",
                "type": "double",
                "default": 2.0,
                "min": -5.0,
                "max": 5.0,
                "construction_key": 1,
            },
            {
                "name": "y",
                "type": "double",
                "default": -2.0,
                "min": -5.0,
                "max": 5.0,
                "construction_key": 2,
            },
        ],
    })
}

optimizer_classes = [
    SMAC,