Feat C++ API
A feature engineering automation tool
|
#include <variation.h>
Public Member Functions | |
Variation (float cr) | |
constructor More... | |
Variation ()=default | |
void | set_cross_rate (float cr) |
update cross rate More... | |
float | get_cross_rate () |
return current cross rate More... | |
~Variation () | |
destructor More... | |
void | vary (Population &pop, const vector< size_t > &parents, const Parameters ¶ms, const Data &d) |
method to handle variation of population More... | |
void | delete_mutate (Individual &child, const Parameters ¶ms) |
void | delete_dimension_mutate (Individual &child, const Parameters ¶ms) |
bool | correlation_delete_mutate (Individual &child, MatrixXf Phi, const Parameters ¶ms, const Data &d) |
Private Member Functions | |
bool | cross (const Individual &mom, const Individual &dad, Individual &child, const Parameters ¶ms, const Data &d) |
crossover More... | |
bool | residual_cross (const Individual &mom, const Individual &dad, Individual &child, const Parameters ¶ms, const Data &d) |
residual crossover More... | |
bool | stagewise_cross (const Individual &mom, const Individual &dad, Individual &child, const Parameters ¶ms, const Data &d) |
stagewise crossover More... | |
bool | mutate (const Individual &mom, Individual &child, const Parameters ¶ms, const Data &d) |
mutation More... | |
void | point_mutate (Individual &child, const Parameters ¶ms) |
void | insert_mutate (Individual &child, const Parameters ¶ms) |
void | splice_programs (NodeVector &vnew, const NodeVector &v1, size_t i1, size_t j1, const NodeVector &v2, size_t i2, size_t j2) |
splice two programs together More... | |
void | print_cross (const Individual &, size_t, size_t, const Individual &, size_t, size_t, Individual &, bool after=true) |
debugging printout of crossover operation. More... | |
Private Attributes | |
float | cross_rate |
fraction of crossover in total variation More... | |
Definition at line 32 of file variation.h.
FT::Vary::Variation::Variation | ( | float | cr | ) |
constructor
methods for crossover and mutation of programs.
Definition at line 11 of file variation.cc.
|
default |
FT::Vary::Variation::~Variation | ( | ) |
destructor
Definition at line 26 of file variation.cc.
bool FT::Vary::Variation::correlation_delete_mutate | ( | Individual & | child, |
MatrixXf | Phi, | ||
const Parameters & | params, | ||
const Data & | d | ||
) |
deletion mutation. works by pruning a dimension. the dimension that is pruned matches these criteria: 1) it is in the pair of features most highly correlated. 2) it is less correlated with the dependent variable than its pair.
child | individual to be mutated |
Phi | the behavior of the parent |
params | parameters |
d | data |
Definition at line 465 of file variation.cc.
|
private |
crossover
crossover by either subtree crossover or swapping of dimensions.
mom | root parent |
dad | parent from which subtree is chosen |
child | result of cross |
params | parameters |
Definition at line 551 of file variation.cc.
void FT::Vary::Variation::delete_dimension_mutate | ( | Individual & | child, |
const Parameters & | params | ||
) |
deletion mutation. works by pruning a dimension.
child | individual to be mutated |
params | parameters |
Definition at line 437 of file variation.cc.
void FT::Vary::Variation::delete_mutate | ( | Individual & | child, |
const Parameters & | params | ||
) |
deletion mutation. works by pruning a dimension.
child | individual to be mutated |
params | parameters |
Definition at line 359 of file variation.cc.
float FT::Vary::Variation::get_cross_rate | ( | ) |
return current cross rate
Definition at line 20 of file variation.cc.
|
private |
insertion mutation.
child | indiviudal to be mutated |
params | parameters |
Definition at line 232 of file variation.cc.
|
private |
mutation
chooses uniformly between point, insert and delete mutation
mom | parent |
child | offspring produced by mutating mom |
params | parameters |
Definition at line 114 of file variation.cc.
|
private |
1/n point mutation.
child | individual to be mutated |
params | parameters |
Definition at line 174 of file variation.cc.
|
private |
debugging printout of crossover operation.
Definition at line 970 of file variation.cc.
|
private |
residual crossover
crossover by swapping in a dimension most correlated with the residual of mom.
mom | root parent |
dad | parent from which subtree is chosen |
child | result of cross |
params | parameters |
Definition at line 645 of file variation.cc.
void FT::Vary::Variation::set_cross_rate | ( | float | cr | ) |
update cross rate
Definition at line 14 of file variation.cc.
|
private |
splice two programs together
swap vector subsets with different sizes. constructs a vector made of v1[0:i1], v2[i2:j2], v1[i1:end].
v1 | root parent |
i1 | start of splicing segment |
j1 | end of splicing segment |
v2 | donating parent |
i2 | start of donation |
j2 | end of donation |
Definition at line 925 of file variation.cc.
|
private |
stagewise crossover
crossover by forward stagewise selection, matching mom's dimensionality.
mom | root parent |
dad | parent from which subtree is chosen |
child | result of cross |
params | parameters |
Definition at line 743 of file variation.cc.
void FT::Vary::Variation::vary | ( | Population & | pop, |
const vector< size_t > & | parents, | ||
const Parameters & | params, | ||
const Data & | d | ||
) |
method to handle variation of population
performs variation on the current population.
pop | current population |
parents | indices of population to use for variation |
params | feat parameters |
Definition at line 40 of file variation.cc.
|
private |
fraction of crossover in total variation
Definition at line 96 of file variation.h.