Feat C++ API
A feature engineering automation tool
n_longitudinal.cc
Go to the documentation of this file.
1 /* FEAT
2 copyright 2017 William La Cava
3 license: GNU/GPL v3
4 */
5 
6 #include "n_longitudinal.h"
7 
8 namespace FT{
9 
10  namespace Pop{
11  namespace Op{
13  {
14  name = "z_"+trim(n);
15 
16  zName = n;
17 
18  otype = 'z';
19  complexity = 1;
20  }
21 
23  void NodeLongitudinal::evaluate(const Data& data, State& state)
24  {
25  try
26  {
27  state.z.push(data.Z.at(zName));
28  }
29  catch (const std::out_of_range& e)
30  {
31  cout << "out of range error on ";
32  cout << "state.z.push(data.Z.at(" << zName << "))\n";
33  cout << "data.Z size: " << data.Z.size() << "\n";
34  cout << "data.Z keys:\n";
35  for (const auto& keys : data.Z)
36  cout << keys.first << ",";
37  cout << "\n";
38  }
39  }
40 
43  {
44  state.zs.push(name);
45  }
46 
48 
50 
51  }
52  }
53 
54 }
data holding X, y, and Z data
Definition: data.h:42
LongData & Z
Definition: data.h:47
void push(type element)
pops element from back of vector and removes it
Definition: state.h:52
void eval_eqn(State &state)
Evaluates the node symbolically.
NodeLongitudinal * rnd_clone_impl() const override
NodeLongitudinal * clone_impl() const override
void evaluate(const Data &data, State &state)
Evaluates the node and updates the state states.
string name
node type
Definition: node.h:56
char otype
output type
Definition: node.h:58
int complexity
complexity of node
Definition: node.h:60
std::string trim(std::string str, const std::string &chars)
Definition: utils.cc:43
main Feat namespace
Definition: data.cc:13
contains various types of State actually used by feat
Definition: state.h:102
Stack< string > zs
longitudinal node string stack
Definition: state.h:110
Stack< std::pair< vector< ArrayXf >, vector< ArrayXf > > > z
longitudinal node stack
Definition: state.h:106