23 template <ProgramType P>
37 while(spot != simplified_program.
Tree.end())
39 Node n = spot.node->data;
53 RetType pred = (*spot.node).predict<RetType>(d);
54 branch_pred = pred.template cast<float>();
58 ArrayXXf out = (*spot.node).
template predict<ArrayXXf>(d);
60 branch_pred = ArrayXf(argmax(out).
template cast<float>());
75 cte.
W = branch_pred.mean();
76 simplified_program.
Tree.erase_children(spot);
77 spot = simplified_program.
Tree.replace(spot, cte);
82 program.
Tree = simplified_program.
Tree;
83 return simplified_program;
holds variable type data.
Program< P > simplify_tree(Program< P > &program, const SearchSpace &ss, const Dataset &d)
#define HANDLE_ERROR_THROW(err)
float variance(const ArrayXf &v)
calculate variance
< nsga2 selection operator for getting the front
auto Isnt(DataType dt) -> bool
auto IsWeighable() noexcept -> bool
tree< Node >::pre_order_iterator TreeIter
class holding the data for a node in a tree.
float get_prob_change() const
NodeType node_type
the node type
DataType ret_type
return data type
float W
the weights of the node. also used for splitting thresholds.
An individual program, a.k.a. model.
Holds a search space, consisting of operations and terminals and functions, and methods to sample tha...
unordered_map< DataType, vector< Node > > terminal_map
Maps return types to terminals.