Exemplo n.º 1
0
    def test_matrix_measure_3(self):
        """
        Test classification_model_performance_matrix. multiple classes case.
        """
        observed = np.array([1, 0, 1, 0, 1, 0, 2, 3])
        calculated = np.array([1, 0, 1, 1, 0, 2, 3, 0])

        measure = evaluation.classification_model_performance_matrix(observed, calculated)
        expected_measure = np.array([[1, 1, 1, 0], [1, 2, 0, 0], [0, 0, 0, 1], [1, 0, 0, 0]])

        np.testing.assert_array_almost_equal(measure, expected_measure)
Exemplo n.º 2
0
    def test_matrix_measure_2(self):
        """
        Test classification_model_performance_matrix. All correct case.
        """
        observed = np.array([0, 1, 0, 1, 0, 0, 1])
        calculated = np.array([0, 1, 1, 0, 0, 0, 1])

        measure = evaluation.classification_model_performance_matrix(observed, calculated)
        expected_measure = np.array([[3, 1], [1, 2]])

        np.testing.assert_array_almost_equal(measure, expected_measure)
Exemplo n.º 3
0
    def test_matrix_measure_2(self):
        """
        Test classification_model_performance_matrix. All correct case.
        """
        observed = np.array([0, 1, 0, 1, 0, 0, 1])
        calculated = np.array([0, 1, 1, 0, 0, 0, 1])

        measure = evaluation.classification_model_performance_matrix(
            observed, calculated)
        expected_measure = np.array([[3, 1], [1, 2]])

        np.testing.assert_array_almost_equal(measure, expected_measure)
Exemplo n.º 4
0
    def test_matrix_measure_3(self):
        """
        Test classification_model_performance_matrix. multiple classes case.
        """
        observed = np.array([1, 0, 1, 0, 1, 0, 2, 3])
        calculated = np.array([1, 0, 1, 1, 0, 2, 3, 0])

        measure = evaluation.classification_model_performance_matrix(
            observed, calculated)
        expected_measure = np.array([[1, 1, 1, 0], [1, 2, 0, 0], [0, 0, 0, 1],
                                     [1, 0, 0, 0]])

        np.testing.assert_array_almost_equal(measure, expected_measure)