Esempio n. 1
0
    def prediction_rankings(self):
        """
        Computes rank of predictions and if they are statistically different
        """
        overall_data = filter_nan(nanmeanw(self.rest, 1)).reshape(
            -1, self.rest.shape[2]
        )

        overall = rank_test_2d(overall_data)
        steps = rank_test_3d(self.rest)

        return overall, steps
Esempio n. 2
0
def test_rank__singlestep__3series_friedman__different_data(dataset_1d):

    arr = np.stack([dataset_1d, dataset_1d, dataset_1d - 1], 1)

    res = rank_test_2d(arr)

    assert res.ranks.shape[0] == 3
    assert res.mean_ranks.shape[0] == 3
    assert res.equality_bool_mask.shape[0] == 3

    assert np.array_equal(res.ranks, np.array([3, 1, 2]))
    assert np.allclose(res.equality_bool_mask, np.array([True, True, False]))
Esempio n. 3
0
def test_rank__singlestep__3series_friedman__identical_data(dataset_1d):

    arr = np.stack([dataset_1d, dataset_1d, dataset_1d], 1)

    res = rank_test_2d(arr)

    assert res.ranks.shape[0] == 3
    assert res.mean_ranks.shape[0] == 3
    assert res.equality_bool_mask.shape[0] == 3

    assert np.array_equal(res.ranks, np.array([1, 2, 3]))
    assert np.allclose(res.equality_bool_mask,
                       np.full_like(res.equality_bool_mask, True))
Esempio n. 4
0
def test_rank__singlestep__2series_mw__different_data(dataset_1d):

    arr = np.stack([dataset_1d + 1, dataset_1d], 1)

    res = rank_test_2d(arr)

    assert res.ranks.shape[0] == 2
    assert res.mean_ranks.shape[0] == 2
    assert res.equality_bool_mask.shape[0] == 2

    assert np.array_equal(res.ranks, np.array([2, 1]))
    assert np.allclose(res.equality_bool_mask,
                       np.full_like(res.equality_bool_mask, False))
Esempio n. 5
0
def test_rank__1d_fail(dataset_1d):
    with pytest.raises(AssertionError):
        rank_test_2d(dataset_1d)
    with pytest.raises(AssertionError):
        rank_test_3d(dataset_1d)