コード例 #1
0
ファイル: test_backward.py プロジェクト: obilaniu/orion
def test_dist_requirements(requirement):
    """Test algorithms dist requirement defined in old requirements API"""
    algo_class = create_algo_class(requires=[requirement, "linear"])
    requirements = backward.get_algo_requirements(algo_class)
    assert len(requirements) == 3
    assert requirements == {
        "type_requirement": requirement,
        "shape_requirement": None,
        "dist_requirement": "linear",
    }
コード例 #2
0
ファイル: test_backward.py プロジェクト: obilaniu/orion
def test_no_changes(requirement):
    """Test algorithms following new requirements API"""
    algo_class = create_algo_class(
        requires_type=requirement, requires_shape="flattened", requires_dist="linear"
    )
    requirements = backward.get_algo_requirements(algo_class)
    assert len(requirements) == 3
    assert requirements == {
        "type_requirement": requirement,
        "shape_requirement": "flattened",
        "dist_requirement": "linear",
    }
コード例 #3
0
ファイル: primary_algo.py プロジェクト: obilaniu/orion
    def __init__(self, space, algorithm_config):
        """
        Initialize the primary algorithm.

        Parameters
        ----------
        space : `orion.algo.space.Space`
           The original definition of a problem's parameters space.
        algorithm_config : dict
           Configuration for the algorithm.

        """
        self.algorithm = None
        super(PrimaryAlgo, self).__init__(space, algorithm=algorithm_config)
        requirements = backward.get_algo_requirements(self.algorithm)
        self.transformed_space = build_required_space(self.space,
                                                      **requirements)
        self.algorithm.space = self.transformed_space
コード例 #4
0
ファイル: primary_algo.py プロジェクト: breuleux/orion
 def __init__(self, algo_constructor, space, **algorithm_config):
     self._space = space
     requirements = backward.get_algo_requirements(algo_constructor)
     self.transformed_space = build_required_space(space, **requirements)
     self.algorithm = algo_constructor(space, **algorithm_config)
     self.algorithm.space = self.transformed_space