Esempio n. 1
0
    def source_competence(self):
        """Calculates the source of competence using the Minimum Difference method.

        The source of competence C_src at the validation point xk calculated by the Minimum Difference between
        the supports obtained to the correct class and the support obtained by the other classes

        Returns
        ----------
        C_src : array of shape = [n_samples, n_classifiers]
                The competence source for each base classifier at each data point.
        """
        C_src = np.zeros((self.n_samples, self.n_classifiers))
        for clf_index in range(self.n_classifiers):
            supports = self._get_scores_dsel(clf_index)
            C_src[:, clf_index] = min_difference(supports, self.DSEL_target)

        return C_src
Esempio n. 2
0
def test_min_difference(supports, idx_correct_label, expected):
    result = min_difference(supports, idx_correct_label)
    assert np.isclose(result, expected, atol=0.01).all()