f7a04171e58eb43dfe5b18d06c76481cdf1c5da9,deslib/dcs/lca.py,LCA,estimate_competence,#LCA#Any#Any#,85
Before Change
dists, idx_neighbors = self._get_region_competence(query)
competences = np.zeros(self.n_classifiers)
for clf_index, clf in enumerate(self.pool_classifiers):
// Check if the dynamic frienemy pruning (DFP) should be used used
if self.DFP_mask[clf_index]:
result = []
predicted_label = predictions[clf_index]
for index in idx_neighbors:
// Get only neighbors from the same class as predicted by the
// classifier (clf) to form the region of competence
if self.DSEL_target[index] == predicted_label:
result.append(self.processed_dsel[index][clf_index])
if len(result) == 0:
competences[clf_index] = 0.0
else:
competences[clf_index] = np.mean(result)
return competences
After Change
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)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
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: commonsense/conceptnet5
Commit Name: 19a796cf092d0b0f88e2919cbee45bb5270835cf
Time: 2017-06-21
Author: rob@luminoso.com
File Name: conceptnet5/vectors/retrofit.py
Class Name:
Method Name: retrofit
Project Name: modAL-python/modAL
Commit Name: d01c5b805e49346914b3b5ace081cae8cbb2a99a
Time: 2018-10-01
Author: theodore.danka@gmail.com
File Name: modAL/density.py
Class Name:
Method Name: information_density