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

Removed some comments

parent c9347ef4
No related branches found
No related tags found
No related merge requests found
...@@ -215,7 +215,7 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting): ...@@ -215,7 +215,7 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
# required by some scikit-learn classifiers (for example # required by some scikit-learn classifiers (for example
# sklearn.svm.SVC) # sklearn.svm.SVC)
dist = np.empty(cost.shape[:2], dtype=cost.dtype, order="C") dist = np.empty(cost.shape[:2], dtype=cost.dtype, order="C")
# NOTE: In Sokol's PhD thesis, the formula for dist is mistakenly given # NOTE: In Sokol Koco's PhD thesis, the formula for dist is mistakenly given
# with a minus sign in section 2.2.2 page 31 # with a minus sign in section 2.2.2 page 31
sum_cost = np.sum(cost[:, np.arange(n_samples), y], axis=1)[:, np.newaxis] sum_cost = np.sum(cost[:, np.arange(n_samples), y], axis=1)[:, np.newaxis]
sum_cost[sum_cost==0] = 1 sum_cost[sum_cost==0] = 1
...@@ -233,7 +233,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting): ...@@ -233,7 +233,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
indicatrice_one_yi[:, np.arange(n_samples), y_i] = 1 indicatrice_one_yi[:, np.arange(n_samples), y_i] = 1
delta = np.ones((self.n_views_, n_samples, self.n_classes_), dtype=np.int) delta = np.ones((self.n_views_, n_samples, self.n_classes_), dtype=np.int)
delta[:, np.arange(n_samples), y_i] = -1 delta[:, np.arange(n_samples), y_i] = -1
# indic_minus_one = np.where(np.arange(self.n_classes_) == y)
return indicate_ones, indicatrice_one_yi, delta return indicate_ones, indicatrice_one_yi, delta
def _compute_edges(self, cost, predicted_classes, y): def _compute_edges(self, cost, predicted_classes, y):
...@@ -268,10 +267,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting): ...@@ -268,10 +267,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
n_views = predicted_classes.shape[0] n_views = predicted_classes.shape[0]
n_samples = y.shape[0] n_samples = y.shape[0]
if use_coop_coef: if use_coop_coef:
# coop_coef = self._compute_coop_coef(predicted_classes, y)
# ajout mucumbo verifier les dim
# ????? coop_cof_beta = betas[predicted_classes]
increment = alphas[:, np.newaxis, np.newaxis] * betas[:, np.newaxis, :] increment = alphas[:, np.newaxis, np.newaxis] * betas[:, np.newaxis, :]
increment = np.tile(increment,(1, n_samples, 1)) increment = np.tile(increment,(1, n_samples, 1))
else: else:
...@@ -324,7 +319,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting): ...@@ -324,7 +319,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
------- -------
betas arrays betas arrays
""" """
# delta = self.delta_c_yi(predicted_classes, y)
indicat, indicate_yi, delta = self._indicatrice(predicted_classes, y) indicat, indicate_yi, delta = self._indicatrice(predicted_classes, y)
delta_vue = np.block(np.split(delta, self.n_views_, axis=0)).squeeze() delta_vue = np.block(np.split(delta, self.n_views_, axis=0)).squeeze()
indicate_vue = np.block(np.split(indicat, self.n_views_, axis=0)).squeeze() indicate_vue = np.block(np.split(indicat, self.n_views_, axis=0)).squeeze()
...@@ -460,10 +454,7 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting): ...@@ -460,10 +454,7 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
self.estimator_weights_beta_ = np.zeros((self.n_iterations_, n_views), dtype=np.float) self.estimator_weights_beta_ = np.zeros((self.n_iterations_, n_views), dtype=np.float)
self.estimator_errors_ = np.array([], dtype=np.float64) self.estimator_errors_ = np.array([], dtype=np.float64)
return return
# probablement la list de h de t global que l'on a a la fin
self.estimators_ = [] self.estimators_ = []
# modification mu cumbo
# mettre deux dim sur n_estimators * n_views
self.estimator_weights_alpha_ = np.zeros((self.n_iterations_, n_views), dtype=np.float64) self.estimator_weights_alpha_ = np.zeros((self.n_iterations_, n_views), dtype=np.float64)
self.estimator_weights_beta_ = np.zeros((self.n_iterations_, n_views, self.n_classes_), dtype=np.float) self.estimator_weights_beta_ = np.zeros((self.n_iterations_, n_views, self.n_classes_), dtype=np.float)
self.estimator_errors_ = np.zeros((n_views, self.n_iterations_), dtype=np.float64) self.estimator_errors_ = np.zeros((n_views, self.n_iterations_), dtype=np.float64)
...@@ -473,7 +464,7 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting): ...@@ -473,7 +464,7 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
predicted_classes, score_function_dif, betas, n_yi) = self._init_var(n_views, y) predicted_classes, score_function_dif, betas, n_yi) = self._init_var(n_views, y)
self.n_yi_ = n_yi self.n_yi_ = n_yi
for current_iteration in range(self.n_iterations_): for current_iteration in range(self.n_iterations_):
# list de h pris a l'etape t # list of h at stage t
dist = self._compute_dist(cost, y) dist = self._compute_dist(cost, y)
# get h_t _i with edges delta # get h_t _i with edges delta
for ind_view in range(n_views): for ind_view in range(n_views):
...@@ -488,13 +479,11 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting): ...@@ -488,13 +479,11 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
# end of choose cost matrix # end of choose cost matrix
# TO DO estimator_errors_ estimate # TO DO estimator_errors_ estimate
########################################### ###########################################
#self.estimator_errors_[current_iteration] = to do
#############self.estimator_errors_[current_iteration] = to do
# update C_t de g # update C_t de g
edges = self._compute_edges(cost, predicted_classes, y) edges = self._compute_edges(cost, predicted_classes, y)
alphas = self._compute_alphas(edges) alphas = self._compute_alphas(edges)
# modif mu cumbo
self.estimator_weights_alpha_[current_iteration, :] = alphas self.estimator_weights_alpha_[current_iteration, :] = alphas
betas = self._compute_betas(alphas, y, score_function_dif, predicted_classes) betas = self._compute_betas(alphas, y, score_function_dif, predicted_classes)
...@@ -540,7 +529,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting): ...@@ -540,7 +529,6 @@ class MuComboClassifier(BaseEnsemble, ClassifierMixin, UBoosting):
dec_func = np.zeros((n_samples, n_classes)) dec_func = np.zeros((n_samples, n_classes))
# update muCombo # update muCombo
# for ind_estimator in range(n_estimators):
for ind_estimator in range(n_estimators): for ind_estimator in range(n_estimators):
ind_iteration = ind_estimator // self.n_views_ ind_iteration = ind_estimator // self.n_views_
current_vue = ind_estimator % self.n_views_ current_vue = ind_estimator % self.n_views_
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment