4abda80dd12518e6bfdc44d067566a3e6947e906,deslib/dcs/a_priori.py,APriori,estimate_competence,#APriori#,91

Before Change


        dists_normalized = 1.0/dists

        competences = np.zeros(self.n_classifiers)
        for clf_index in range(self.n_classifiers):

            // Check if the dynamic frienemy pruning (DFP) should be used used
            if self.DFP_mask[clf_index]:
                result = np.zeros(self.k)
                for counter, index in enumerate(idx_neighbors):
                    target = self.DSEL_target[index]
                    // get the post_prob for the correct class
                    //post_prob = self._get_scores_dsel(clf_index, index)[target]
                    post_prob = self.dsel_scores[index, clf_index, target]

                    result[counter] = (post_prob * dists_normalized[counter])

                competences[clf_index] = sum(result)/sum(dists_normalized)
        return competences

After Change


        scores_target_class = self.dsel_scores[idx_neighbors, :, self.DSEL_target[idx_neighbors]]

        // Multiply the scores obtained for the correct class to the distances of each corresponding neighbor
        scores_target_class *= np.expand_dims(dists_normalized, axis=2)

        // Sum the scores obtained for each neighbor and divide by the sum of all distances
        competences = np.sum(scores_target_class, axis=1)/ np.sum(dists_normalized, axis=1)

        // competences = np.zeros(self.n_classifiers)
        // for clf_index in range(self.n_classifiers):
        //
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: scikit-learn-contrib/DESlib
Commit Name: 4abda80dd12518e6bfdc44d067566a3e6947e906
Time: 2018-03-28
Author: rafaelmenelau@gmail.com
File Name: deslib/dcs/a_priori.py
Class Name: APriori
Method Name: estimate_competence


Project Name: tensorflow/tpu
Commit Name: 0638b9c86cfec273b2e5799aea281ffa74d9161d
Time: 2020-05-12
Author: pengchong@google.com
File Name: models/official/detection/serving/inputs.py
Class Name:
Method Name: raw_image_tensor_input


Project Name: kundajelab/dragonn
Commit Name: 38512d92a8682a62e73c5b9e86366888be374532
Time: 2019-05-29
Author: annashcherbina@gmail.com
File Name: dragonn/interpret/ism.py
Class Name:
Method Name: in_silico_mutagenesis


Project Name: scikit-learn-contrib/DESlib
Commit Name: f0c15f219b0761b14329ddd416cda82fa4bae841
Time: 2018-03-28
Author: rafaelmenelau@gmail.com
File Name: deslib/dcs/mcb.py
Class Name: MCB
Method Name: estimate_competence