diff --git a/code/bolsonaro/models/ensemble_selection_forest_regressor.py b/code/bolsonaro/models/ensemble_selection_forest_regressor.py index 1edbab0479b4553e290eb6eafcb1f1ad84a984e9..fb399d19e06efe61a84ec9956800b74a1709d8bb 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