예제 #1
0
    def test__inverse_transform_no_min_no_max(self, mock_sys):
        """Test that the method ``_inverse_transform`` performs a normalization of values between
        ``min`` and ``max`` with no min or max set.
        """
        # setup
        mock_sys.maxsize = 1000
        instance = IntHyperParam()
        values = np.array([[0.0009], [0.1008]])

        # run
        result = instance._inverse_transform(values)

        # assert
        expected_result = np.array([[-500],
                                    [-400]])

        np.testing.assert_array_equal(result, expected_result.astype(int))
예제 #2
0
    def test__inverse_transform_min_max(self, mock_sys):
        """Test that the method ``_inverse_transform`` performs a normalization of values between
        ``min`` and ``max`` with a min and max value set up.
        """
        # setup
        _min = 0
        _max = 10
        instance = IntHyperParam(min=_min, max=_max)
        values = np.array([[0.1], [0.9]])

        # run
        result = instance._inverse_transform(values)

        # assert
        expected_result = np.array([[1],
                                    [9]])

        np.testing.assert_array_equal(result, expected_result.astype(int))