MCPcopy Create free account
hub / github.com/abess-team/abess / final_fitting

Method final_fitting

src/Algorithm.h:597–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595 }
596
597 void final_fitting(T4 &train_x, T1 &train_y, Eigen::VectorXd &train_weight, Eigen::VectorXi &A,
598 Eigen::VectorXi &g_index, Eigen::VectorXi &g_size, int train_n, int N) {
599 Eigen::VectorXi A_ind = find_ind(A, g_index, g_size, (this->beta).rows(), N);
600 T4 X_A = X_seg(train_x, train_n, A_ind, this->model_type);
601 T2 beta_A;
602 slice(this->beta, A_ind, beta_A);
603
604 this->primary_model_fit_max_iter += FINAL_FIT_ITER_ADD;
605 // coef0_old = this->coef0;
606 bool success =
607 this->primary_model_fit(X_A, train_y, train_weight, beta_A, this->coef0, DBL_MAX, A, g_index, g_size);
608 // if (!success){
609 // this->coef0 = coef0_old;
610 // }else{
611 slice_restore(beta_A, A_ind, this->beta);
612 this->train_loss = this->loss_function(X_A, train_y, train_weight, beta_A, this->coef0, A, g_index, g_size,
613 this->lambda_level);
614 // }
615 this->primary_model_fit_max_iter -= FINAL_FIT_ITER_ADD;
616 }
617
618 virtual double loss_function(T4 &X, T1 &y, Eigen::VectorXd &weights, T2 &beta, T3 &coef0, Eigen::VectorXi &A,
619 Eigen::VectorXi &g_index, Eigen::VectorXi &g_size, double lambda) {

Callers 1

fitMethod · 0.95

Calls 7

primary_model_fitMethod · 0.95
loss_functionMethod · 0.95
find_indFunction · 0.85
X_segFunction · 0.85
slice_restoreFunction · 0.85
sliceFunction · 0.70
rowsMethod · 0.45

Tested by

no test coverage detected