def test_if_negative_evidence_is_distributed(self):
        stratifier = IterativeStratification(n_splits=2, order=1)
        y = np.matrix([[0, 0], [1, 0], [0, 1], [1, 1]])

        rows, rows_used, all_combinations, per_row_combinations, samples_with_combination, folds = \
            stratifier._prepare_stratification(y)

        stratifier._distribute_positive_evidence(rows_used, folds, samples_with_combination, per_row_combinations)
        self.assertFalse(rows_used[0])

        stratifier._distribute_negative_evidence(rows_used, folds)
        self.assertTrue(rows_used[0])
    def test_if_negative_evidence_is_distributed(self):
        stratifier = IterativeStratification(n_splits=2, order=1)
        y = np.matrix([[0, 0], [1, 0], [0, 1], [1, 1]])

        rows, rows_used, all_combinations, per_row_combinations, samples_with_combination, folds = \
            stratifier._prepare_stratification(y)

        stratifier._distribute_positive_evidence(rows_used, folds,
                                                 samples_with_combination,
                                                 per_row_combinations)
        self.assertFalse(rows_used[0])

        stratifier._distribute_negative_evidence(rows_used, folds)
        self.assertTrue(rows_used[0])
    def test_if_positive_evidence_does_not_include_negative_evidence(self):
        stratifier = IterativeStratification(n_splits=2, order=1)
        y = np.matrix([[0, 0], [1, 0], [0, 1], [1, 1]])

        rows, rows_used, all_combinations, per_row_combinations, samples_with_combination, folds = \
            stratifier._prepare_stratification(y)

        stratifier._distribute_positive_evidence(rows_used, folds, samples_with_combination, per_row_combinations)
        self.assertFalse(rows_used[0])
        self.assertTrue(rows_used[1])
        self.assertTrue(rows_used[2])
        self.assertTrue(rows_used[3])

        for combination, samples in stratifier.desired_samples_per_combination_per_fold.items():
            for desire in samples:
                self.assertEqual(desire, 0)
    def test_if_positive_evidence_does_not_include_negative_evidence(self):
        stratifier = IterativeStratification(n_splits=2, order=1)
        y = np.matrix([[0, 0], [1, 0], [0, 1], [1, 1]])

        rows, rows_used, all_combinations, per_row_combinations, samples_with_combination, folds = \
            stratifier._prepare_stratification(y)

        stratifier._distribute_positive_evidence(rows_used, folds,
                                                 samples_with_combination,
                                                 per_row_combinations)
        self.assertFalse(rows_used[0])
        self.assertTrue(rows_used[1])
        self.assertTrue(rows_used[2])
        self.assertTrue(rows_used[3])

        for combination, samples in stratifier.desired_samples_per_combination_per_fold.items(
        ):
            for desire in samples:
                self.assertEqual(desire, 0)