コード例 #1
0
ファイル: test_numerical.py プロジェクト: x10-utils/BTB
    def test__transform_no_min_no_max(self, mock_sys):
        """Test that the method ``_transform`` performs a normalization of values between ``min``
        and ``max`` with no limit set on them.
        """
        # setup
        mock_sys.maxsize = 1000  # This values can be different in each OS.
        instance = IntHyperParam()
        values = np.array([[9], [100]])

        # run
        result = instance._transform(values)

        # assert
        expected_result = np.array([[0.50899101],
                                    [0.5999001]])

        np.testing.assert_allclose(result, expected_result)
コード例 #2
0
ファイル: test_numerical.py プロジェクト: x10-utils/BTB
    def test__transform_no_min_max(self, mock_sys):
        """Test that the method ``_transform`` performs a normalization of values between ``min``
        and ``max`` with a max value set in.
        """
        # setup
        mock_sys.maxsize = 1000
        _max = 10
        instance = IntHyperParam(max=_max)
        values = np.array([[1], [9]])

        # run
        result = instance._transform(values)

        # assert
        expected_result = np.array([[0.981409],
                                    [0.99706458]])

        np.testing.assert_allclose(result, expected_result)
コード例 #3
0
ファイル: test_numerical.py プロジェクト: x10-utils/BTB
    def test__transform_min_max(self, mock_sys):
        """Test that the method ``_transform`` performs a normalization of values between ``min``
        and ``max`` with a max and min value set in.
        """
        # setup
        _min = 0
        _max = 10

        instance = IntHyperParam(min=_min, max=_max)
        values = np.array([[9], [1]])

        # run
        result = instance._transform(values)

        # assert
        expected_result = np.array([[0.86363636],
                                    [0.13636364]])

        np.testing.assert_allclose(result, expected_result)