Commit 0806656a authored by Thomas Purcell's avatar Thomas Purcell
Browse files

Bug fixes

More feature elimination steps. Clear out register when doing generation/proejction
parent 97d607bc
......@@ -324,10 +324,12 @@ std::vector<double> FeatureSpace::project_r(double* prop, int size, std::vector<
void FeatureSpace::project_generated(double* prop, int size, std::vector<std::shared_ptr<FeatureNode>>& phi_sel, std::vector<double>& scores_sel, std::vector<double>& scores_comp)
{
for(auto feat = _phi.begin() + _mpi_comm->rank(); feat < _phi.end(); feat += _mpi_comm->size())
for(auto feat = _phi.begin() + _start_gen.back() + _mpi_comm->rank(); feat < _phi.end(); feat += _mpi_comm->size())
{
int feat_ind = _phi.size();
std::fill_n(node_value_arrs::TEMP_STORAGE_REG.data(), node_value_arrs::TEMP_STORAGE_REG.size(), -1);
std::fill_n(node_value_arrs::TEMP_STORAGE_TEST_REG.data(), node_value_arrs::TEMP_STORAGE_TEST_REG.size(), -1);
int feat_ind = _phi.size();
std::vector<node_ptr> generated_phi;
generate_new_feats(feat, generated_phi, feat_ind, _l_bound, _u_bound);
......@@ -440,7 +442,6 @@ void FeatureSpace::sis(std::vector<double>& prop)
if(is_valid)
{
std::cout << _phi[inds[ii]]->expr() << _scores[inds[ii]] << std::endl;
scores_sel[cur_feat_local] = _scores[inds[ii]];
phi_sel.push_back(std::make_shared<FeatureNode>(cur_feat + cur_feat_local, _phi[inds[ii]]->expr(), _phi[inds[ii]]->value(), _phi[inds[ii]]->test_value(), _phi[inds[ii]]->unit(), true));
++cur_feat_local;
......
......@@ -100,7 +100,8 @@ public:
set_value(offset);
node_value_arrs::temp_storage_reg(_arr_ind, offset) = _arr_ind;
}
// for(auto& feat: _feats)
// std::cout << *feat->value_ptr() << '\t';
return node_value_arrs::get_value_ptr(_arr_ind, offset);
}
......
......@@ -6,7 +6,7 @@ InvNode::InvNode()
InvNode::InvNode(std::array<node_ptr, 1> feats, int feat_ind, double l_bound, double u_bound):
OperatorNode(feats, feat_ind)
{
if((feats[0]->type() == NODE_TYPE::DIV) || (feats[0]->type() == NODE_TYPE::EXP) || (feats[0]->type() == NODE_TYPE::NEG_EXP))
if((feats[0]->type() == NODE_TYPE::DIV) || (feats[0]->type() == NODE_TYPE::EXP) || (feats[0]->type() == NODE_TYPE::NEG_EXP) || (feats[0]->type() == NODE_TYPE::CB) || (feats[0]->type() == NODE_TYPE::SQ) || (feats[0]->type() == NODE_TYPE::CBRT) || (feats[0]->type() == NODE_TYPE::SQRT) || (feats[0]->type() == NODE_TYPE::SIX_POW ))
throw InvalidFeatureException();
set_value();
......@@ -19,7 +19,7 @@ InvNode::InvNode(std::array<node_ptr, 1> feats, int feat_ind, double l_bound, do
InvNode::InvNode(node_ptr feat, int feat_ind, double l_bound, double u_bound):
OperatorNode({feat}, feat_ind)
{
if((feat->type() == NODE_TYPE::DIV) || (feat->type() == NODE_TYPE::EXP) || (feat->type() == NODE_TYPE::NEG_EXP))
if((feat->type() == NODE_TYPE::DIV) || (feat->type() == NODE_TYPE::EXP) || (feat->type() == NODE_TYPE::NEG_EXP) || (feat->type() == NODE_TYPE::CB) || (feat->type() == NODE_TYPE::SQ) || (feat->type() == NODE_TYPE::CBRT) || (feat->type() == NODE_TYPE::SQRT) || (feat->type() == NODE_TYPE::SIX_POW ))
throw InvalidFeatureException();
set_value();
......
......@@ -9,19 +9,20 @@
namespace node_value_arrs
{
extern std::vector<double> TEMP_STORAGE_ARR; //!< Array to temporarily store feature values
extern std::vector<double> VALUES_ARR; //!< Value of the stored features
extern std::vector<double> TEMP_STORAGE_TEST_ARR; //!< Array to temporarily store feature values
extern std::vector<double> TEST_VALUES_ARR; //!< Value of the stored features test values
extern std::vector<double> D_MATRIX; //!< The descriptor matrix
extern std::vector<int> TEMP_STORAGE_REG; //!< Register to see which feature is stored in each slot
extern std::vector<int> TEMP_STORAGE_TEST_REG; //!< Register to see which feature is stored in each slot
extern int N_SELECTED; //!< Number of features selected
extern int N_SAMPLES; //!< Number of samples in the nodes
extern int N_SAMPLES_TEST; //!< Number of samples in the nodes
extern int N_STORE_FEATURES; //!< Number of features with stored values
extern int N_RUNGS_STORED; //!< Number of rungs with values stored
extern std::vector<int> TEMP_STORAGE_REG; //!< Register to see which feature is stored in each slot
extern std::vector<int> TEMP_STORAGE_TEST_REG; //!< Register to see which feature is stored in each slot
extern std::vector<double> D_MATRIX; //!< The descriptor matrix
extern std::vector<double> VALUES_ARR; //!< Value of the stored features
extern std::vector<double> TEST_VALUES_ARR; //!< Value of the stored features test values
extern std::vector<double> TEMP_STORAGE_ARR; //!< Array to temporarily store feature values
extern std::vector<double> TEMP_STORAGE_TEST_ARR; //!< Array to temporarily store feature values
/**
* @brief Get the maximum number of new features for each rung
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment