From fcbc03e2ebcc24ff90e041caf6c6ca97d351c64c Mon Sep 17 00:00:00 2001 From: Luc Giffon <luc.giffon@lis-lab.fr> Date: Tue, 24 Mar 2020 18:48:56 +0100 Subject: [PATCH] add few comments in ensemble selection method --- code/bolsonaro/models/ensemble_selection_forest_regressor.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/bolsonaro/models/ensemble_selection_forest_regressor.py b/code/bolsonaro/models/ensemble_selection_forest_regressor.py index 1edbab0..fb399d1 100644 --- a/code/bolsonaro/models/ensemble_selection_forest_regressor.py +++ b/code/bolsonaro/models/ensemble_selection_forest_regressor.py @@ -30,6 +30,8 @@ class EnsembleSelectionForest(ForestPruningSOTA, metaclass=ABCMeta): mean_so_far = val_predictions[idx_best_score] while nb_selected_trees < self._extracted_forest_size: # every new tree is selected with replacement as specified in the base paper + + # this matrix contains at each line the predictions of the previous subset + the corresponding tree of the line # mean update formula: u_{t+1} = (n_t * u_t + x_t) / (n_t + 1) mean_prediction_subset_with_extra_tree = (nb_selected_trees * mean_so_far + val_predictions) / (nb_selected_trees + 1) predictions_subset_with_extra_tree = self._activation(mean_prediction_subset_with_extra_tree) @@ -37,6 +39,7 @@ class EnsembleSelectionForest(ForestPruningSOTA, metaclass=ABCMeta): idx_best_extra_tree = self._best_score_idx(scores_subset_with_extra_tree) lst_pruned_forest.append(self._base_estimator.estimators_[idx_best_extra_tree]) + # update new mean prediction mean_so_far = mean_prediction_subset_with_extra_tree[idx_best_extra_tree] nb_selected_trees += 1 -- GitLab