Esempio n. 1
0
    def test_rmsle_random_arrays_finite_values(self, y_true, y_pred):
        rmsle_value = rmsle(y_true, y_pred)
        expected_rmsle = self._correct_rmsle(y_true, y_pred)
        print(y_true)
        print(y_pred)

        assert expected_rmsle == rmsle_value
Esempio n. 2
0
    def test_rmsle_dataframe(self):
        y_true = pd.DataFrame([0, 1, 2, 3, 4, 5])
        y_pred = pd.DataFrame([1, 4, 5, 10, 4, 1])

        rmsle_value = np.round(rmsle(y_true, y_pred), decimals=2)
        expected_rmsle = 0.82

        assert expected_rmsle == rmsle_value
Esempio n. 3
0
    def test_rmsle_array(self):
        y_true = np.array([0, 1, 2, 3, 4, 5])
        y_pred = np.array([1, 4, 5, 10, 4, 1])

        rmsle_value = np.round(rmsle(y_true, y_pred), decimals=2)
        expected_rmsle = 0.82

        assert expected_rmsle == rmsle_value
Esempio n. 4
0
    def test_rmsle_list(self):
        y_true = [0, 1, 2, 3, 4, 5]
        y_pred = [1, 4, 5, 10, 4, 1]

        rmsle_value = np.round(rmsle(y_true, y_pred), decimals=2)
        expected_rmsle = 0.82

        assert expected_rmsle == rmsle_value
Esempio n. 5
0
    def test_rmsle_negative_values(self):
        y_true = np.array([0, 1, 2, 3, 4, -5])
        y_pred = np.array([0, 0, 0, 0, 0, 0])

        with pytest.raises(ValueError):
            rmsle(y_true, y_pred)
Esempio n. 6
0
    def test_infinite_values(self):
        y_true = np.random.random(4)
        y_pred = [0, np.inf, 2, 3]

        with pytest.raises(ValueError):
            rmsle(y_true, y_pred)
Esempio n. 7
0
    def test_nan_values(self):
        y_true = [np.nan, 1, 2, 3]
        y_pred = np.random.random(4)

        with pytest.raises(ValueError):
            rmsle(y_true, y_pred)
Esempio n. 8
0
    def test_wrong_vector_length(self):
        y_true = np.random.random(5)
        y_pred = np.random.random(4)

        with pytest.raises(ValueError):
            rmsle(y_true, y_pred)