Feat C++ API
A feature engineering automation tool
nodemap.h
Go to the documentation of this file.
1 /* FEAT
2 copyright 2017 William La Cava
3 license: GNU/GPL v3
4 */
5 #ifndef NODEMAP
6 #define NODEMAP
7 
8 #include "nodewrapper.h"
9 
10 namespace FT{
11 namespace Pop{
12 namespace Op{
13 
14 struct NodeMap
15 {
16  std::map<std::string, Node*> node_map;
17 
19  {
20  this->node_map = {
21  //arithmetic operators
22  { "+", new NodeAdd({1.0,1.0})},
23  { "-", new NodeSubtract({1.0,1.0})},
24  { "*", new NodeMultiply({1.0,1.0})},
25  { "/", new NodeDivide({1.0,1.0})},
26  { "sqrt", new NodeSqrt({1.0})},
27  { "sin", new NodeSin({1.0})},
28  { "cos", new NodeCos({1.0})},
29  { "tanh", new NodeTanh({1.0})},
30  { "^2", new NodeSquare({1.0})},
31  { "^3", new NodeCube({1.0})},
32  { "^", new NodeExponent({1.0})},
33  { "exp", new NodeExponential({1.0})},
34  { "gauss", new NodeGaussian({1.0})},
35  { "gauss2d", new Node2dGaussian({1.0, 1.0})},
36  { "log", new NodeLog({1.0}) },
37  { "logit", new NodeLogit({1.0}) },
38  { "relu", new NodeRelu({1.0}) },
39  { "b2f", new NodeFloat<bool>() },
40  { "c2f", new NodeFloat<int>() },
41 
42  // logical operators
43  { "and", new NodeAnd() },
44  { "or", new NodeOr() },
45  { "not", new NodeNot() },
46  { "xor", new NodeXor() },
47  { "=", new NodeEqual() },
48  { ">", new NodeGreaterThan() },
49  { ">=", new NodeGEQ() },
50  { "<", new NodeLessThan() },
51  { "<=", new NodeLEQ() },
52  { "split", new NodeSplit<float>() },
53  { "fuzzy_split", new NodeFuzzySplit<float>() },
54  { "fuzzy_fixed_split", new NodeFuzzyFixedSplit<float>() },
55  { "split_c", new NodeSplit<int>() },
56  { "fuzzy_split_c", new NodeFuzzySplit<int>() },
57  { "fuzzy_fixed_split_c", new NodeFuzzyFixedSplit<int>() },
58  { "if", new NodeIf() },
59  { "ite", new NodeIfThenElse() },
60  { "step", new NodeStep() },
61  { "sign", new NodeSign() },
62 
63  // longitudinal nodes
64  { "mean", new NodeMean() },
65  { "median", new NodeMedian() },
66  { "max", new NodeMax() },
67  { "min", new NodeMin() },
68  { "variance", new NodeVar() },
69  { "skew", new NodeSkew() },
70  { "kurtosis", new NodeKurtosis() },
71  { "slope", new NodeSlope() },
72  { "count", new NodeCount() },
73  { "recent", new NodeRecent() },
74  // terminals
75  { "variable_f", new NodeVariable<float>() },
76  { "variable_b", new NodeVariable<bool>() },
77  { "variable_c", new NodeVariable<int>() },
78  { "constant_b", new NodeConstant(false) },
79  { "constant_d", new NodeConstant(0.0) },
80  };
81  };
82 
84  {
85  for (auto it = node_map.cbegin(); it != node_map.cend(); )
86  {
87  delete it->second;
88  node_map.erase(it++); // or "it = m.erase(it)" since C++11
89  }
90  };
91 
92 };
93 static NodeMap NM;
94 }}}
95 #endif
static NodeMap NM
Definition: nodemap.h:93
main Feat namespace
Definition: data.cc:13
std::map< std::string, Node * > node_map
Definition: nodemap.h:16