7704337b2f1ef68952848b1e622e62497e0fe0b8,pythonds/dcs/a_posteriori.py,APosteriori,estimate_competence,#APosteriori#Any#,83

Before Change


            if self.mask[clf_index]:
                result = []
                predicted_label = clf.predict(query)
                counter = 0
                dists_temp = np.zeros(self.k)
                for index_neighbor in idx_neighbors:
                    // Get only neighbors from the same class as predicted by the
                    // classifier (clf) to form the region of competence
                    target = self.DSEL_target[index_neighbor]
                    if target == predicted_label[0]:
                        // weight by distance
                        post_prob = self._get_scores_dsel(clf_index, index_neighbor)[target]
                        result.append(post_prob * dists[index_neighbor])
                        dists_temp[counter] = dists[index_neighbor]
                        counter += 1
                    if counter >= self.k:
                        break
                competences[clf_index] = sum(result)/sum(dists_temp)

        return competences

After Change


            if self.mask[clf_index]:

                result = []
                dists_temp = []
                predicted_label = clf.predict(query)[0]

                for counter, neighbor in enumerate(idx_neighbors):
                    // Get only neighbors from the same class as predicted by the
                    // classifier (clf) to form the region of competence
                    target = self.DSEL_target[neighbor]
                    if target == predicted_label:
                        // get the posterior probability for the target class
                        post_prob = self._get_scores_dsel(clf_index, neighbor)[target]
                        // weight by distance
                        result.append(post_prob * dists_normalized[counter])
                        // keep the distance for normalization
                        dists_temp.append(dists_normalized[counter])
                if len(result) > 0 and len(dists_temp) > 0:
                    competences[clf_index] = sum(result)/sum(dists_temp)
                else:
                    competences[clf_index] = 0
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: scikit-learn-contrib/DESlib
Commit Name: 7704337b2f1ef68952848b1e622e62497e0fe0b8
Time: 2017-12-27
Author: rafaelmenelau@gmail.com
File Name: pythonds/dcs/a_posteriori.py
Class Name: APosteriori
Method Name: estimate_competence


Project Name: scikit-learn-contrib/DESlib
Commit Name: 7704337b2f1ef68952848b1e622e62497e0fe0b8
Time: 2017-12-27
Author: rafaelmenelau@gmail.com
File Name: pythonds/dcs/mla.py
Class Name: MLA
Method Name: estimate_competence


Project Name: rusty1s/pytorch_geometric
Commit Name: 492d3a52c0a0f92c9cfe3fa8c5e207cb2d34fc45
Time: 2017-11-06
Author: matthias.fey@tu-dortmund.de
File Name: examples/cora.py
Class Name:
Method Name: