Skip to content
Snippets Groups Projects
Commit fcbc03e2 authored by Luc Giffon's avatar Luc Giffon
Browse files

add few comments in ensemble selection method

parent 8d52496f
No related branches found
No related tags found
1 merge request!23Resolve "integration-sota"
...@@ -30,6 +30,8 @@ class EnsembleSelectionForest(ForestPruningSOTA, metaclass=ABCMeta): ...@@ -30,6 +30,8 @@ class EnsembleSelectionForest(ForestPruningSOTA, metaclass=ABCMeta):
mean_so_far = val_predictions[idx_best_score] mean_so_far = val_predictions[idx_best_score]
while nb_selected_trees < self._extracted_forest_size: while nb_selected_trees < self._extracted_forest_size:
# every new tree is selected with replacement as specified in the base paper # 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 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) 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) predictions_subset_with_extra_tree = self._activation(mean_prediction_subset_with_extra_tree)
...@@ -37,6 +39,7 @@ class EnsembleSelectionForest(ForestPruningSOTA, metaclass=ABCMeta): ...@@ -37,6 +39,7 @@ class EnsembleSelectionForest(ForestPruningSOTA, metaclass=ABCMeta):
idx_best_extra_tree = self._best_score_idx(scores_subset_with_extra_tree) 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]) 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] mean_so_far = mean_prediction_subset_with_extra_tree[idx_best_extra_tree]
nb_selected_trees += 1 nb_selected_trees += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment