diff --git a/src/feature_creation/feature_space/FeatureSpace.cpp b/src/feature_creation/feature_space/FeatureSpace.cpp index 7522bb184c08a4593ce291c295a3ce7f3a6abace..2585db170384d660f75a77bcefda4386e4b5bd5b 100644 --- a/src/feature_creation/feature_space/FeatureSpace.cpp +++ b/src/feature_creation/feature_space/FeatureSpace.cpp @@ -39,7 +39,7 @@ FeatureSpace::FeatureSpace( _task_sizes(task_sizes), _start_gen(1, 0), _feature_space_file("feature_space/selected_features.txt"), - _feature_space_hr_file("feature_space/selected_features_hr.txt"), + _feature_space_summary_file("feature_space/SIS_summary.txt"), _mpi_comm(mpi_comm), _l_bound(min_abs_feat_val), _u_bound(max_abs_feat_val), @@ -66,13 +66,13 @@ void FeatureSpace::initialize_fs(std::vector<double> prop) if(_mpi_comm->rank() == 0) { std::ofstream out_file_stream = std::ofstream(); - std::ofstream out_file_stream_hr = std::ofstream(); + std::ofstream sum_file_stream = std::ofstream(); out_file_stream.open(_feature_space_file); - out_file_stream_hr.open(_feature_space_hr_file); - out_file_stream << std::setw(14) <<std::left << "# FEAT_ID" << std::setw(24) << std::left << "Score" << "Feature Postfix Expression (RPN)" << std::endl; - out_file_stream_hr << std::setw(14) <<std::left << "# FEAT_ID" << std::setw(24) << std::left << "Score" << "Feature Postfix Expression (RPN)" << std::endl; + sum_file_stream.open(_feature_space_summary_file); + out_file_stream << std::setw(14) <<std::left << "# FEAT_ID" << "Feature Postfix Expression (RPN)" << std::endl; + sum_file_stream << std::setw(14) <<std::left << "# FEAT_ID" << std::setw(24) << std::left << "Score" << "Feature Expression" << std::endl; out_file_stream.close(); - out_file_stream_hr.close(); + sum_file_stream.close(); } _project = project_funcs::project_r; @@ -503,8 +503,8 @@ void FeatureSpace::sis(std::vector<double>& prop) std::ofstream out_file_stream = std::ofstream(); out_file_stream.open(_feature_space_file, std::ios::app); - std::ofstream out_file_stream_hr = std::ofstream(); - out_file_stream_hr.open(_feature_space_hr_file, std::ios::app); + std::ofstream sum_file_stream = std::ofstream(); + sum_file_stream.open(_feature_space_summary_file, std::ios::app); std::vector<double> scores_comp(std::max(node_value_arrs::N_SELECTED, _n_sis_select), 1.0); std::vector<double> scores_sel(_n_sis_select, 0.0); @@ -649,8 +649,8 @@ void FeatureSpace::sis(std::vector<double>& prop) inds = util_funcs::argsort(sent_scores); for(int ii = 0; ii < _n_sis_select; ++ii) { - out_file_stream << std::setw(14) <<std::left << cur_feat << std::setw(24) << std::setprecision(18) << std::left << -1 * sent_scores[inds[ii]] << sent_phi[inds[ii]]->postfix_expr() << std::endl; - out_file_stream_hr << std::setw(14) <<std::left << cur_feat << std::setw(24) << std::setprecision(18) << std::left << -1 * sent_scores[inds[ii]] << sent_phi[inds[ii]]->expr() << std::endl; + out_file_stream << std::setw(14) <<std::left << cur_feat << sent_phi[inds[ii]]->postfix_expr() << std::endl; + sum_file_stream << std::setw(14) <<std::left << cur_feat << std::setw(24) << std::setprecision(18) << std::left << -1 * sent_scores[inds[ii]] << sent_phi[inds[ii]]->expr() << std::endl; _phi_selected.push_back(sent_phi[inds[ii]]); _phi_selected.back()->set_selected(true); _phi_selected.back()->set_d_mat_ind(cur_feat); @@ -673,8 +673,8 @@ void FeatureSpace::sis(std::vector<double>& prop) { if(valid_score_against_current(cur_feat_local, sent_phi[inds[ii]]->value().data(), sent_scores[inds[ii]], scores_sel, scores_comp)) { - out_file_stream << std::setw(14) <<std::left << cur_feat << std::setw(24) << std::setprecision(18) << std::left << -1 * sent_scores[inds[ii]] << sent_phi[inds[ii]]->postfix_expr() << std::endl; - out_file_stream_hr << std::setw(14) <<std::left << cur_feat << std::setw(24) << std::setprecision(18) << std::left << -1 * sent_scores[inds[ii]] << sent_phi[inds[ii]]->expr() << std::endl; + out_file_stream << std::setw(14) <<std::left << cur_feat << sent_phi[inds[ii]]->postfix_expr() << std::endl; + sum_file_stream << std::setw(14) <<std::left << cur_feat << std::setw(24) << std::setprecision(18) << std::left << -1 * sent_scores[inds[ii]] << sent_phi[inds[ii]]->expr() << std::endl; _phi_selected.push_back(sent_phi[inds[ii]]); @@ -720,8 +720,8 @@ void FeatureSpace::sis(std::vector<double>& prop) inds = util_funcs::argsort(scores_sel); for(auto& ind : inds) { - out_file_stream << std::setw(14) <<std::left << cur_feat << std::setw(24) << std::setprecision(18) << std::left << -1 * scores_sel[ind] << phi_sel[ind]->postfix_expr() << std::endl; - out_file_stream_hr << std::setw(14) <<std::left << cur_feat << std::setw(24) << std::setprecision(18) << std::left << -1 * scores_sel[ind] << phi_sel[ind]->expr() << std::endl; + out_file_stream << std::setw(14) <<std::left << cur_feat << phi_sel[ind]->postfix_expr() << std::endl; + sum_file_stream << std::setw(14) <<std::left << cur_feat << std::setw(24) << std::setprecision(18) << std::left << -1 * scores_sel[ind] << phi_sel[ind]->expr() << std::endl; _phi_selected.push_back(phi_sel[ind]); _phi_selected.back()->set_d_mat_ind(cur_feat); _phi_selected.back()->set_value(); @@ -740,10 +740,10 @@ void FeatureSpace::sis(std::vector<double>& prop) out_file_stream << std::endl; out_file_stream.close(); - out_file_stream_hr << "#"; + sum_file_stream << "#"; for(int dd = 0; dd < 71; ++dd) - out_file_stream_hr << "-"; - out_file_stream_hr << std::endl; - out_file_stream_hr.close(); + sum_file_stream << "-"; + sum_file_stream << std::endl; + sum_file_stream.close(); } } diff --git a/src/feature_creation/feature_space/FeatureSpace.hpp b/src/feature_creation/feature_space/FeatureSpace.hpp index 7d1439310295409e57de9f2fac51c8e48aa56f96..6e3e383f5620a31287272dfd21eab2d216ee3df2 100644 --- a/src/feature_creation/feature_space/FeatureSpace.hpp +++ b/src/feature_creation/feature_space/FeatureSpace.hpp @@ -50,7 +50,7 @@ class FeatureSpace std::vector<int> _task_sizes; //!< The number of elements in each task (training data) std::vector<int> _start_gen; //!< list of the indexes where each generation starts in _phi std::string _feature_space_file; //!< File to store information about the selected features - std::string _feature_space_hr_file; //!< File to store information about the selected features + std::string _feature_space_summary_file; //!< File to store information about the selected features std::function<void(double*, double*, std::vector<node_ptr>&, std::vector<int>&, int)> _project; //!< Function used to calculate the scores for SIS std::shared_ptr<MPI_Interface> _mpi_comm; //!< MPI communicator diff --git a/src/feature_creation/node/utils.cpp b/src/feature_creation/node/utils.cpp index 8ce5260798b82bc3d477183ad15e8b4e3bc7bd99..63a66a6b9bd9e61105bc7156b4281942fbd15261 100644 --- a/src/feature_creation/node/utils.cpp +++ b/src/feature_creation/node/utils.cpp @@ -98,7 +98,7 @@ std::vector<node_ptr> str2node::phi_selected_from_file(std::string filename, std node_value_arrs::resize_d_matrix_arr(1); boost::algorithm::split(split_line, line, boost::algorithm::is_any_of("\t "), boost::token_compress_on); - node_ptr new_feat = postfix2node(split_line[2], phi_0, feat_ind); + node_ptr new_feat = postfix2node(split_line[1], phi_0, feat_ind); new_feat->set_selected(true); new_feat->set_d_mat_ind(feat_sel); diff --git a/src/python/feature_creation/FeatureSpace.cpp b/src/python/feature_creation/FeatureSpace.cpp index 5979a05c67fd1ab7e0b9573fd3df7c9f79328e05..16d72b1f45abbd1a82fcbc8965add3e8b9fae870 100644 --- a/src/python/feature_creation/FeatureSpace.cpp +++ b/src/python/feature_creation/FeatureSpace.cpp @@ -19,7 +19,7 @@ FeatureSpace::FeatureSpace( _task_sizes(python_conv_utils::from_list<int>(task_sizes)), _start_gen(1, 0), _feature_space_file("feature_space/selected_features.txt"), - _feature_space_hr_file("feature_space/selected_features_hr.txt"), + _feature_space_summary_file("feature_space/SIS_summary.txt"), _mpi_comm(mpi_setup::comm), _l_bound(min_abs_feat_val), _u_bound(max_abs_feat_val), @@ -52,7 +52,7 @@ FeatureSpace::FeatureSpace( _task_sizes(python_conv_utils::from_list<int>(task_sizes)), _start_gen(1, 0), _feature_space_file("feature_space/selected_features.txt"), - _feature_space_hr_file("feature_space/selected_features_hr.txt"), + _feature_space_summary_file("feature_space/SIS_summary.txt"), _mpi_comm(mpi_setup::comm), _l_bound(min_abs_feat_val), _u_bound(max_abs_feat_val),