예제 #1
0
    def test__acquire_best_ei_neq_best_y(self):
        """Best Expected Improvement does NOT correspond to the best prediction."""

        # Set-up
        tuner = GPEi(tuple(), r_minimum=2)
        tuner.y = np.array([0.5, 0.6, 0.7])

        # Run
        predictions = np.array([[0.8, 2], [0.9, 1]])
        best = tuner._acquire(predictions)

        # assert
        assert best == 0
예제 #2
0
    def test__acquire_higher_mean_equal_std(self):
        # When the stds are equal but the mean s higher, it is selected

        # Set-up
        tuner = GPEi(tuple(), r_minimum=2)
        tuner.y = np.array([0.5, 0.6, 0.7])

        # Run
        predictions = np.array([[0.8, 1], [0.9, 1]])
        best = tuner._acquire(predictions)

        # assert
        assert best == 1
예제 #3
0
    def test__acquire_higher_mean_and_std(self):
        # When both the mean and std of one point is higher, it is selected

        # Set-up
        tuner = GPEi(tuple(), r_minimum=2)
        tuner.y = np.array([0.5, 0.6, 0.7])

        # Run
        predictions = np.array([[0.8, 1], [0.9, 2]])
        best = tuner._acquire(predictions)

        # assert
        assert best == 1
예제 #4
0
파일: test_gp.py 프로젝트: wuqixiaobai/BTB
    def test__acquire_best_ei_neq_best_y(self):
        """Best Expected Improvement does NOT correspond to the best prediction."""

        # Set-up
        tuner = GPEi(tuple(), r_minimum=2)
        tuner.y = np.array([0.5, 0.6, 0.7])

        # Run
        predictions = np.array([
            [0.8, 2],
            [0.9, 1]
        ])
        best = tuner._acquire(predictions)

        # assert
        assert best == 0
예제 #5
0
    def test__acquire_possible_error(self):
        """Manually crafted case that seems to be an error in the formula:

        The second prediction has a higher score and both have the same stdev.
        However, the formula indicates that the first prediction is the best one.
        """

        # Set-up
        tuner = GPEi(tuple(), r_minimum=2)
        tuner.y = np.array([0.5, 0.6, 0.7])

        # Run
        predictions = np.array([[0.8, 1], [0.9, 1]])
        best = tuner._acquire(predictions)

        # assert
        assert best == 0
예제 #6
0
    def test__acquire_lower_mean_higher_std(self):
        # When the mean is higher but the std is lower, both outcomes are possible
        # Create a situation with a much larger std to demonstrate.

        # Set-up
        tuner = GPEi(tuple(), r_minimum=2)
        tuner.y = np.array([0.5, 0.6, 0.7])

        # Run
        predictions = np.array([
            [0.9, 1],
            [0.8, 100],
        ])
        best = tuner._acquire(predictions)

        # assert
        assert best == 1
예제 #7
0
파일: test_gp.py 프로젝트: wuqixiaobai/BTB
    def test__acquire_possible_error(self):
        """Manually crafted case that seems to be an error in the formula:

        The second prediction has a higher score and both have the same stdev.
        However, the formula indicates that the first prediction is the best one.
        """

        # Set-up
        tuner = GPEi(tuple(), r_minimum=2)
        tuner.y = np.array([0.5, 0.6, 0.7])

        # Run
        predictions = np.array([
            [0.8, 1],
            [0.9, 1]
        ])
        best = tuner._acquire(predictions)

        # assert
        assert best == 0