Skip to content
Snippets Groups Projects
Commit c6783173 authored by Baptiste Bauvin's avatar Baptiste Bauvin
Browse files

Corrected difficulty score

parent 7b3e918b
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@ class DiversityFusion(BaseMultiviewClassifier):
estimator.fit(X.get_v(view_idx, train_indices), y[train_indices])
self.estimator_pool[classifier_idx].append(estimator)
else:
pass #Todo
pass #TODO
self.monoview_estimators = self.choose_combination(X, y, train_indices, views_indices)
return self
......
......@@ -9,23 +9,21 @@ classifier_class_name = "DifficultyFusion"
class DifficultyFusion(GlobalDiversityFusion):
def diversity_measure(self, classifiers_decisions, combination, y):
_, nb_view, nb_examples = classifiers_decisions.shape
scores = np.zeros((nb_view, nb_examples), dtype=int)
for view_index, classifier_index in enumerate(combination):
scores[view_index] = np.logical_not(
scores[view_index, :] = np.logical_not(
np.logical_xor(classifiers_decisions[classifier_index,
view_index],
y)
)
# difficulty_scores = np.sum(scores, axis=0)
# TODO : Check computing method
difficulty_score = np.mean(
np.var(
# Table of the nuber of views that succeeded for each example :
difficulty_scores = np.sum(scores, axis=0)
difficulty_score = np.var(
np.array([
np.sum((scores==view_index), axis=1)/float(nb_view)
np.sum((difficulty_scores == view_index))
for view_index in range(len(combination)+1)])
, axis=0)
)
return difficulty_score
......
......@@ -20,4 +20,4 @@ class Test_difficulty_fusion(unittest.TestCase):
cls.classifiers_decisions,
cls.combination,
cls.y)
cls.assertAlmostEqual(difficulty_measure, 0.22453703703703706)
cls.assertAlmostEqual(difficulty_measure, 0.1875)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment