// Check if the dynamic frienemy pruning (DFP) should be used used
if self.DFP_mask[clf_index]:
clf_competence = [self.processed_dsel[sample_idx][clf_index] for sample_idx in selected_idx]
competences[clf_index] = np.mean(np.array(clf_competence))
return competences
After Change
// Use the masked array mean to take into account the removed neighbors
processed_pred = np.ma.MaskedArray(self.processed_dsel[idx_neighbors, :], mask=~boolean_mask)
competences = np.ma.mean(processed_pred, axis=1)
return competences