44bdf9be3b913a1a0e90115e45edbee192d01b90,deslib/des/probabilistic.py,Probabilistic,estimate_competence,#Probabilistic#,113

Before Change


        
        // TODO: Adapt this function to batch processing
        dists, idx_neighbors = self._get_region_competence(query)
        dists_organized = np.array([dists[index] for index in np.argsort(idx_neighbors)])

        potential_dists = self.potential_func(dists_organized)
        sum_potential = np.sum(potential_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]:
                temp_competence = np.multiply(self.C_src[:, clf_index], potential_dists)
                competences[clf_index] = np.sum(temp_competence)/sum_potential

        return competences

    def select(self, competences):

After Change


        // TODO: Adapt this function to batch processing
        dists, idx_neighbors = self._get_region_competence(query)
        idx_neighbors = np.atleast_2d(idx_neighbors)
        dists = np.atleast_2d(dists)
        dists_organized = np.take(dists, idx_neighbors)

        //dists_organized = np.array([dists[index] for index in np.argsort(idx_neighbors)])
        potential_dists = self.potential_func(dists_organized)
        sum_potential = np.sum(potential_dists, axis=1)

        competences = np.einsum("ijk,ij->ik", self.C_src[np.newaxis, :, :], potential_dists)
        competences = competences/sum_potential.reshape(-1, 1)

        // 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
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: scikit-learn-contrib/DESlib
Commit Name: 44bdf9be3b913a1a0e90115e45edbee192d01b90
Time: 2018-03-31
Author: rafaelmenelau@gmail.com
File Name: deslib/des/probabilistic.py
Class Name: Probabilistic
Method Name: estimate_competence


Project Name: dask/dask-image
Commit Name: b470898504d2a077433a84e12a7c8078b2494760
Time: 2018-10-01
Author: jakirkham@gmail.com
File Name: dask_image/ndmeasure/__init__.py
Class Name:
Method Name: center_of_mass


Project Name: eriklindernoren/PyTorch-GAN
Commit Name: 9dfafadcea9f709132bce12341a32ff5e27ec33a
Time: 2018-04-24
Author: eriklindernoren@gmail.com
File Name: implementations/infogan/infogan.py
Class Name:
Method Name: sample_image