Skip to content

Commit 0c24bad

Browse files
wip
1 parent d1876a2 commit 0c24bad

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

cpp/APLRRegressor.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ class APLRRegressor
9292
void scale_training_observations_if_using_log_link_function();
9393
void revert_scaling_if_using_log_link_function();
9494
void cap_predictions_to_minmax_in_training(VectorXd &predictions);
95+
std::string compute_raw_base_term_name(const Term &term, const std::string &X_name);
96+
std::string compute_raw_given_term_name(const Term &term, const std::vector<std::string> &X_names);
9597

9698
public:
9799
//Fields
@@ -562,8 +564,9 @@ void APLRRegressor::update_gradient_and_errors()
562564
void APLRRegressor::find_best_split_for_each_eligible_term()
563565
{
564566
best_term=std::numeric_limits<size_t>::max();
565-
lowest_error_sum=neg_gradient_nullmodel_errors_sum;
566-
if(n_jobs!=1 && terms_eligible_current.size()>1) //if multithreading
567+
lowest_error_sum=neg_gradient_nullmodel_errors_sum;
568+
bool multithreading{n_jobs!=1 && terms_eligible_current.size()>1};
569+
if(multithreading)
567570
{
568571
distributed_terms=distribute_terms_to_cores(terms_eligible_current,n_jobs);
569572

@@ -592,7 +595,8 @@ void APLRRegressor::find_best_split_for_each_eligible_term()
592595
//Chooses best term
593596
for (size_t i = 0; i < terms_eligible_current.size(); ++i)
594597
{
595-
if(terms_eligible_current[i].ineligible_boosting_steps==0) //if term is actually eligible
598+
bool term_is_eligible{terms_eligible_current[i].ineligible_boosting_steps==0};
599+
if(term_is_eligible)
596600
{
597601
if(std::isless(terms_eligible_current[i].split_point_search_errors_sum,lowest_error_sum))
598602
{
@@ -602,11 +606,12 @@ void APLRRegressor::find_best_split_for_each_eligible_term()
602606
}
603607
}
604608
}
605-
else //Not multithreading
609+
else
606610
{
607611
for (size_t i = 0; i < terms_eligible_current.size(); ++i)
608612
{
609-
if(terms_eligible_current[i].ineligible_boosting_steps==0) //if term is actually eligible
613+
bool term_is_eligible{terms_eligible_current[i].ineligible_boosting_steps==0};
614+
if(term_is_eligible)
610615
{
611616
terms_eligible_current[i].estimate_split_point(X_train,neg_gradient_current,sample_weight_train,bins,v,min_observations_in_split);
612617
if(std::isless(terms_eligible_current[i].split_point_search_errors_sum,lowest_error_sum))

0 commit comments

Comments
 (0)