f7a04171e58eb43dfe5b18d06c76481cdf1c5da9,deslib/dcs/lca.py,LCA,estimate_competence,#LCA#Any#Any#,85

Before Change


                if len(result) == 0:
                    competences[clf_index] = 0.0
                else:
                    competences[clf_index] = np.mean(result)

        return competences

After Change



        _, idx_neighbors = self._get_region_competence(query)
        idx_neighbors = np.atleast_2d(idx_neighbors)
        predictions = np.atleast_2d(predictions)

        // Expanding the dimensions of the predictions and target arrays in order to compare both.
        predictions_3d = np.expand_dims(predictions, axis=1)
        target_3d = np.expand_dims(self.DSEL_target[idx_neighbors], axis=2)
        // Create a mask to remove the neighbors belonging to a different class than the predicted by the base classifier
        mask = (predictions_3d != target_3d)
        masked_preprocessed = np.ma.MaskedArray(self.processed_dsel[idx_neighbors, :], mask=mask)

        competences_masked = np.mean(masked_preprocessed, axis=1)
        // Fill 0 to the masked values in the resulting array (when no neighbors belongs to the class predicted by
        // the corresponding base classifier)
        competences = np.ma.filled(competences_masked, 0)

        return competences
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: scikit-learn-contrib/DESlib
Commit Name: f7a04171e58eb43dfe5b18d06c76481cdf1c5da9
Time: 2018-03-29
Author: rafaelmenelau@gmail.com
File Name: deslib/dcs/lca.py
Class Name: LCA
Method Name: estimate_competence


Project Name: scikit-learn-contrib/DESlib
Commit Name: f7a04171e58eb43dfe5b18d06c76481cdf1c5da9
Time: 2018-03-29
Author: rafaelmenelau@gmail.com
File Name: deslib/dcs/lca.py
Class Name: LCA
Method Name: estimate_competence


Project Name: arviz-devs/arviz
Commit Name: 32692a1ae53d7c5bf36564aeca1b572ddf40f9f0
Time: 2018-06-29
Author: aloctavodia@gmail.com
File Name: arviz/stats/stats.py
Class Name:
Method Name: r2_score


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