@@ -109,7 +109,6 @@ class APLRRegressor
109109 std::vector<std::string> term_names;
110110 VectorXd term_coefficients;
111111 size_t max_interaction_level;
112- VectorXd intercept_steps;
113112 size_t max_interactions; // max interactions allowed to add (counted in interactions_eligible)
114113 size_t interactions_eligible; // interactions that were eligible when training the model
115114 VectorXd validation_error_steps; // validation error for each boosting step
@@ -146,7 +145,6 @@ class APLRRegressor
146145 VectorXd get_validation_error_steps ();
147146 VectorXd get_feature_importance ();
148147 double get_intercept ();
149- VectorXd get_intercept_steps ();
150148 size_t get_m ();
151149 double get_validation_group_mse ();
152150};
@@ -159,7 +157,7 @@ APLRRegressor::APLRRegressor(size_t m,double v,uint_fast32_t random_state,std::s
159157 reserved_terms_times_num_x{reserved_terms_times_num_x},intercept{intercept},m{m},v{v},
160158 family{family},link_function{link_function},validation_ratio{validation_ratio},n_jobs{n_jobs},random_state{random_state},
161159 bins{bins},verbosity{verbosity},max_interaction_level{max_interaction_level},
162- intercept_steps{ VectorXd ( 0 )}, max_interactions{max_interactions},interactions_eligible{0 },validation_error_steps{VectorXd (0 )},
160+ max_interactions{max_interactions},interactions_eligible{0 },validation_error_steps{VectorXd (0 )},
163161 min_observations_in_split{min_observations_in_split},ineligible_boosting_steps_added{ineligible_boosting_steps_added},
164162 max_eligible_terms{max_eligible_terms},number_of_base_terms{0 },tweedie_power{tweedie_power},min_training_prediction_or_response{NAN_DOUBLE},
165163 max_training_prediction_or_response{NAN_DOUBLE},validation_group_mse{NAN_DOUBLE},group_size_for_validation_group_mse{group_size_for_validation_group_mse}
@@ -172,8 +170,8 @@ APLRRegressor::APLRRegressor(const APLRRegressor &other):
172170 family{other.family },link_function{other.link_function },validation_ratio{other.validation_ratio },
173171 n_jobs{other.n_jobs },random_state{other.random_state },bins{other.bins },
174172 verbosity{other.verbosity },term_names{other.term_names },term_coefficients{other.term_coefficients },
175- max_interaction_level{other.max_interaction_level },intercept_steps {other.intercept_steps },
176- max_interactions{other. max_interactions }, interactions_eligible{other.interactions_eligible },validation_error_steps{other.validation_error_steps },
173+ max_interaction_level{other.max_interaction_level },max_interactions {other.max_interactions },
174+ interactions_eligible{other.interactions_eligible },validation_error_steps{other.validation_error_steps },
177175 min_observations_in_split{other.min_observations_in_split },ineligible_boosting_steps_added{other.ineligible_boosting_steps_added },
178176 max_eligible_terms{other.max_eligible_terms },number_of_base_terms{other.number_of_base_terms },
179177 feature_importance{other.feature_importance },tweedie_power{other.tweedie_power },min_training_prediction_or_response{other.min_training_prediction_or_response },
@@ -420,7 +418,6 @@ void APLRRegressor::initialize()
420418 terms.clear ();
421419
422420 intercept=0 ;
423- intercept_steps=VectorXd::Constant (m,0 );
424421
425422 terms_eligible_current.reserve (X_train.cols ()*reserved_terms_times_num_x);
426423 for (size_t i = 0 ; i < static_cast <size_t >(X_train.cols ()); ++i)
@@ -519,7 +516,6 @@ void APLRRegressor::update_intercept()
519516 intercept=neg_gradient_current.mean ();
520517 else
521518 intercept=(neg_gradient_current.array ()*sample_weight_train.array ()).sum ()/sample_weight_train.array ().sum ();
522- intercept_steps=VectorXd::Constant (m,intercept);
523519 linear_predictor_update=VectorXd::Constant (neg_gradient_current.size (),intercept);
524520 linear_predictor_update_validation=VectorXd::Constant (y_validation.size (),intercept);
525521 update_linear_predictor_and_predictors ();
@@ -886,13 +882,6 @@ void APLRRegressor::print_summary_after_boosting_step(size_t boosting_step)
886882
887883void APLRRegressor::update_coefficients_for_all_steps ()
888884{
889- // Filling down coefficient_steps for the intercept
890- for (size_t j = 0 ; j < m; ++j) // For each boosting step
891- {
892- if (j>0 && is_approximately_zero (intercept_steps[j]) && !is_approximately_zero (intercept_steps[j-1 ]))
893- intercept_steps[j]=intercept_steps[j-1 ];
894- }
895- // Filling down coefficient_steps for each term in the model
896885 for (size_t i = 0 ; i < terms.size (); ++i) // For each term
897886 {
898887 for (size_t j = 0 ; j < m; ++j) // For each boosting step
@@ -916,7 +905,6 @@ void APLRRegressor::find_optimal_m_and_update_model_accordingly()
916905 // Choosing optimal m and updating coefficients
917906 size_t best_boosting_step_index;
918907 validation_error_steps.minCoeff (&best_boosting_step_index); // boosting step with lowest error
919- intercept=intercept_steps[best_boosting_step_index];
920908 for (size_t i = 0 ; i < terms.size (); ++i) // for each term set coefficient
921909 {
922910 terms[i].coefficient =terms[i].coefficient_steps [best_boosting_step_index];
@@ -1194,11 +1182,6 @@ double APLRRegressor::get_intercept()
11941182 return intercept;
11951183}
11961184
1197- VectorXd APLRRegressor::get_intercept_steps ()
1198- {
1199- return intercept_steps;
1200- }
1201-
12021185size_t APLRRegressor::get_m ()
12031186{
12041187 return m;
0 commit comments