@@ -76,7 +76,7 @@ class APLRRegressor
7676 void find_sorted_indexes_for_errors_for_interactions_to_consider ();
7777 void add_promising_interactions_and_select_the_best_one ();
7878 void update_intercept (size_t boosting_step);
79- void select_the_best_term_and_update_errors (size_t boosting_step, bool not_evaluating_prioritized_predictors = true );
79+ void select_the_best_term_and_update_errors (size_t boosting_step);
8080 void remove_ineligibility ();
8181 void update_terms (size_t boosting_step);
8282 void update_gradient_and_errors ();
@@ -789,7 +789,7 @@ void APLRRegressor::execute_boosting_step(size_t boosting_step)
789789 best_term_index = find_best_term_index (terms_eligible_current, terms_eligible_current_indexes_for_a_base_term);
790790 std::vector<size_t > predictor_index{index};
791791 consider_interactions (predictor_index);
792- select_the_best_term_and_update_errors (boosting_step, false );
792+ select_the_best_term_and_update_errors (boosting_step);
793793 }
794794 }
795795 }
@@ -1123,15 +1123,11 @@ void APLRRegressor::add_promising_interactions_and_select_the_best_one()
11231123 }
11241124}
11251125
1126- void APLRRegressor::select_the_best_term_and_update_errors (size_t boosting_step, bool not_evaluating_prioritized_predictors )
1126+ void APLRRegressor::select_the_best_term_and_update_errors (size_t boosting_step)
11271127{
11281128 bool no_term_was_selected{best_term_index == std::numeric_limits<size_t >::max ()};
11291129 if (no_term_was_selected)
1130- {
1131- if (not_evaluating_prioritized_predictors)
1132- remove_ineligibility ();
11331130 return ;
1134- }
11351131
11361132 linear_predictor_update = terms_eligible_current[best_term_index].calculate_contribution_to_linear_predictor (X_train);
11371133 linear_predictor_update_validation = terms_eligible_current[best_term_index].calculate_contribution_to_linear_predictor (X_validation);
@@ -1213,12 +1209,11 @@ void APLRRegressor::prune_terms(size_t boosting_step)
12131209 if (term_is_used)
12141210 {
12151211 linear_predictor_update = -terms[i].calculate_contribution_to_linear_predictor (X_train);
1216- linear_predictor_update_validation = -terms[i].calculate_contribution_to_linear_predictor (X_validation);
1217- double error_after_updating_term = calculate_sum_error (calculate_errors (neg_gradient_current, linear_predictor_update, sample_weight_train, MSE_LOSS_FUNCTION));
1218- bool improvement{std::islessequal (error_after_updating_term, new_error)};
1212+ double error_after_pruning_term = calculate_sum_error (calculate_errors (neg_gradient_current, linear_predictor_update, sample_weight_train, MSE_LOSS_FUNCTION));
1213+ bool improvement{std::islessequal (error_after_pruning_term, new_error)};
12191214 if (improvement)
12201215 {
1221- new_error = error_after_updating_term ;
1216+ new_error = error_after_pruning_term ;
12221217 index_for_term_to_remove = i;
12231218 }
12241219 }
@@ -1227,7 +1222,6 @@ void APLRRegressor::prune_terms(size_t boosting_step)
12271222 if (removal_of_term_is_better)
12281223 {
12291224 linear_predictor_update = -terms[index_for_term_to_remove].calculate_contribution_to_linear_predictor (X_train);
1230- linear_predictor_update_validation = -terms[index_for_term_to_remove].calculate_contribution_to_linear_predictor (X_validation);
12311225 terms[index_for_term_to_remove].coefficient = 0.0 ;
12321226 update_linear_predictor_and_predictions ();
12331227 update_gradient_and_errors ();
0 commit comments