Exemple #1
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.0
        _max = 10.0

        instance = FloatHyperParam(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)
Exemple #2
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.float_info.max = 1000.0
        mock_sys.float_info.min = 0.0

        instance = FloatHyperParam()
        values = np.array([[0.1], [0.2]])

        # run
        result = instance._inverse_transform(values)

        # assert
        expected_result = np.array([[100.],
                                    [200.]])

        np.testing.assert_array_equal(result, expected_result)