f1292b23b2c7685c54c98485ca5346273554faa1,deslib/base.py,DS,_frienemy_pruning,#DS#,390

Before Change


            return mask
        else:
            // The sample is located in a safe region. All base classifiers can predict the label
            mask = np.ones(self.n_classifiers)
        return mask

    def _get_classifier_ensemble(self, indices):
        This function receive the indices of the selected classifiers and returns an ensemble with the selected

After Change


        n_samples, n_neighbors = self.neighbors.shape
        mask = np.zeros((n_samples, self.n_classifiers))

        for sample_idx in enumerate(n_samples):
            // Check if query is in a indecision region
            neighbors_y = self.DSEL_target[self.neighbors[sample_idx, :self.safe_k]]

            if len(set(neighbors_y)) > 1:
                // There are more than on class in the region of competence (So it is an indecision region).
                //mask = np.zeros(self.n_classifiers)

                // Check if the base classifier predict the correct label for a sample belonging to each class.
                for clf_index in range(self.n_classifiers):
                    predictions = self.processed_dsel[self.neighbors[sample_idx, :self.safe_k], clf_index]
                    correct_class_pred = [self.DSEL_target[index] for count, index in
                                          enumerate(self.neighbors[sample_idx, :self.safe_k])
                                          if predictions[count] == 1]
                    
                    // If that is true, it means that it correctly classified at least one neighbor for each class in 
                    the region of competence
                    
                    if np.unique(correct_class_pred).size > 1:
                        mask[sample_idx, clf_index] = 1
                // Check if all classifiers were pruned
                if not np.count_nonzero(mask):
                    // Do not apply the pruning mechanism.
                    mask[sample_idx, clf_index, :] = 1
                    //mask = np.ones(self.n_classifiers)
                return mask
            else:
                // The sample is located in a safe region. All base classifiers can predict the label
                mask[sample_idx, :] = 1
                // mask = np.ones(self.n_classifiers)
        return mask

    def _get_classifier_ensemble(self, indices):
        This function receive the indices of the selected classifiers and returns an ensemble with the selected
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: scikit-learn-contrib/DESlib
Commit Name: f1292b23b2c7685c54c98485ca5346273554faa1
Time: 2018-03-26
Author: rafaelmenelau@gmail.com
File Name: deslib/base.py
Class Name: DS
Method Name: _frienemy_pruning


Project Name: D2KLab/entity2rec
Commit Name: 23ee13aef276de7ad726eb4825e201d3c885c008
Time: 2018-01-25
Author: enricopalumbo0@gmail.com
File Name: entity2rec/entity2rec.py
Class Name: Entity2Rec
Method Name: content_similarities


Project Name: eriklindernoren/Keras-GAN
Commit Name: 5c18953a3da18402d3fcc9ff96d1e983d48c98cb
Time: 2018-04-16
Author: eriklindernoren@gmail.com
File Name: pix2pix/pix2pix.py
Class Name: Pix2Pix
Method Name: train