Feat C++ API
A feature engineering automation tool
|
individual programs in the population More...
#include <individual.h>
Public Types | |
typedef Array< bool, Dynamic, Dynamic, RowMajor > | ArrayXXb |
Public Member Functions | |
Individual () | |
void | initialize (const Parameters ¶ms, bool random, int id=0) |
copy assignment More... | |
MatrixXf | out (const Data &d, bool predict=false) |
calculate program output matrix Phi More... | |
MatrixXf | out_trace (const Data &d, vector< Trace > &stack_trace) |
calculate program output while maintaining stack trace More... | |
MatrixXf | state_to_phi (State &state) |
converts program states to output matrices More... | |
shared_ptr< CLabels > | fit (const Data &d, const Parameters ¶ms, bool &pass) |
fits an ML model to the data after transformation More... | |
shared_ptr< CLabels > | fit (const Data &d, const Parameters ¶ms) |
fits an ML model to the data after transformation More... | |
shared_ptr< CLabels > | fit_tune (const Data &d, const Parameters ¶ms, bool set_default=false) |
fits and tunes an ML model to the data after transformation More... | |
void | tune (const Data &d, const Parameters ¶ms) |
tunes an ML model to the data after transformation More... | |
shared_ptr< CLabels > | predict (const Data &d) |
VectorXf | predict_vector (const Data &d) |
ArrayXXf | predict_proba (const Data &d) |
string | get_eqn () |
return symbolic representation of program More... | |
vector< string > | get_features () |
return vectorized representation of program More... | |
string | program_str () const |
return program name list More... | |
void | set_rank (unsigned r) |
setting and getting from individuals vector More... | |
int | size () const |
return size of program More... | |
int | get_n_params () |
get number of params in program More... | |
unsigned int | get_dim () |
grab sub-tree locations given starting point. More... | |
int | check_dominance (const Individual &b) const |
check whether this dominates b. More... | |
void | set_obj (const vector< string > &) |
set obj vector given a string of objective names More... | |
unsigned int | set_complexity () |
calculate program complexity and return it. More... | |
unsigned int | get_complexity () const |
get the program complexity without updating it. More... | |
void | clone (Individual &cpy, bool sameid=true) const |
clone this individual More... | |
Individual | clone () |
void | set_id (unsigned i) |
void | set_parents (const vector< Individual > &parents) |
set parent ids using parents More... | |
void | set_parents (const vector< int > &parents) |
set parent ids using id values More... | |
vector< float > | get_p () const |
get probabilities of variation More... | |
float | get_p (const size_t i, bool normalize=true) const |
get inverted weight probability for pogram location i More... | |
vector< float > | get_p (const vector< size_t > &locs, bool normalize=false) const |
get probability of variation for program locations locs More... | |
void | set_p (const vector< float > &weights, const float &fb, const bool softmax_norm=false) |
set probabilities More... | |
std::map< char, size_t > | get_max_state_size () |
get maximum stack size needed for evaluation. More... | |
void | save (string filename) |
save individual as a json object. More... | |
void | load (string filename) |
load individual from a file. More... | |
Public Attributes | |
NodeVector | program |
executable data structure More... | |
MatrixXf | Phi |
transformation output of program More... | |
VectorXf | yhat |
current output More... | |
VectorXf | error |
training error More... | |
shared_ptr< ML > | ml |
ML model, trained on Phi. More... | |
float | fitness |
aggregate fitness score More... | |
float | fitness_v |
aggregate validation fitness score More... | |
float | fairness |
aggregate fairness score More... | |
float | fairness_v |
aggregate validation fairness score More... | |
vector< float > | w |
weights from ML training on program output More... | |
vector< float > | p |
probability of variation of subprograms More... | |
unsigned int | dim |
dimensionality of individual More... | |
vector< float > | obj |
objectives for use with Pareto selection More... | |
unsigned int | dcounter |
number of individuals this dominates More... | |
vector< unsigned int > | dominated |
individual indices this dominates More... | |
unsigned int | rank |
pareto front rank More... | |
float | crowd_dist |
crowding distance on the Pareto front More... | |
unsigned int | complexity |
the complexity of the program. More... | |
vector< char > | dtypes |
the data types of each column of the More... | |
unsigned | id |
tracking id More... | |
vector< int > | parent_id |
ids of parents More... | |
string | eqn |
equation form of the program More... | |
individual programs in the population
Definition at line 31 of file individual.h.
typedef Array<bool, Dynamic, Dynamic, RowMajor> FT::Pop::Individual::ArrayXXb |
Definition at line 173 of file individual.h.
FT::Pop::Individual::Individual | ( | ) |
Definition at line 11 of file individual.cc.
int FT::Pop::Individual::check_dominance | ( | const Individual & | b | ) | const |
check whether this dominates b.
Definition at line 898 of file individual.cc.
Individual FT::Pop::Individual::clone | ( | ) |
Definition at line 71 of file individual.cc.
void FT::Pop::Individual::clone | ( | Individual & | cpy, |
bool | sameid = true |
||
) | const |
clone this individual
Definition at line 82 of file individual.cc.
shared_ptr< CLabels > FT::Pop::Individual::fit | ( | const Data & | d, |
const Parameters & | params | ||
) |
fits an ML model to the data after transformation
Definition at line 264 of file individual.cc.
shared_ptr< CLabels > FT::Pop::Individual::fit | ( | const Data & | d, |
const Parameters & | params, | ||
bool & | pass | ||
) |
fits an ML model to the data after transformation
Definition at line 234 of file individual.cc.
shared_ptr< CLabels > FT::Pop::Individual::fit_tune | ( | const Data & | d, |
const Parameters & | params, | ||
bool | set_default = false |
||
) |
fits and tunes an ML model to the data after transformation
Definition at line 1019 of file individual.cc.
unsigned int FT::Pop::Individual::get_complexity | ( | ) | const |
get the program complexity without updating it.
Definition at line 109 of file individual.cc.
unsigned int FT::Pop::Individual::get_dim | ( | ) |
grab sub-tree locations given starting point.
get program dimensionality
Output:
@return the dimensionality, i.e. number of outputs, of a program. the dimensionality is equal to the number of times the program arities are fully satisfied.
Definition at line 873 of file individual.cc.
string FT::Pop::Individual::get_eqn | ( | ) |
return symbolic representation of program
Definition at line 748 of file individual.cc.
vector< string > FT::Pop::Individual::get_features | ( | ) |
return vectorized representation of program
Definition at line 817 of file individual.cc.
std::map< char, size_t > FT::Pop::Individual::get_max_state_size | ( | ) |
get maximum stack size needed for evaluation.
Definition at line 995 of file individual.cc.
int FT::Pop::Individual::get_n_params | ( | ) |
get number of params in program
Definition at line 96 of file individual.cc.
vector< float > FT::Pop::Individual::get_p | ( | ) | const |
get probabilities of variation
Definition at line 122 of file individual.cc.
float FT::Pop::Individual::get_p | ( | const size_t | i, |
bool | normalize = true |
||
) | const |
get inverted weight probability for pogram location i
i | index in program |
normalize | (true): normalizes the probability by the size of the subprogram. Useful when the total probability over the program nodes should sum to 1. |
Definition at line 175 of file individual.cc.
vector< float > FT::Pop::Individual::get_p | ( | const vector< size_t > & | locs, |
bool | normalize = false |
||
) | const |
get probability of variation for program locations locs
locs | program indices to return probabilities for. |
normalize | (false): normalize probabilities by size of subprogram |
Definition at line 217 of file individual.cc.
void FT::Pop::Individual::initialize | ( | const Parameters & | params, |
bool | random, | ||
int | id = 0 |
||
) |
copy assignment
Definition at line 27 of file individual.cc.
void FT::Pop::Individual::load | ( | string | filename | ) |
load individual from a file.
Definition at line 1061 of file individual.cc.
MatrixXf FT::Pop::Individual::out | ( | const Data & | d, |
bool | predict = false |
||
) |
calculate program output matrix Phi
d | Data structure |
params | Feat parameters |
predict | if true, this guarantees nodes like split do not get trained |
Definition at line 391 of file individual.cc.
calculate program output while maintaining stack trace
X | n_features x n_samples data |
Z | longitudinal nodes for samples |
y | target data |
Feat parameters |
Definition at line 544 of file individual.cc.
shared_ptr< CLabels > FT::Pop::Individual::predict | ( | const Data & | d | ) |
generates prediction on data using transformation and ML predict.
drop_idx | if specified, the phi output at drop_idx is set to zero, effectively removing its output from the transformation. used in semantic crossover. |
Definition at line 271 of file individual.cc.
ArrayXXf FT::Pop::Individual::predict_proba | ( | const Data & | d | ) |
Definition at line 293 of file individual.cc.
VectorXf FT::Pop::Individual::predict_vector | ( | const Data & | d | ) |
Definition at line 311 of file individual.cc.
string FT::Pop::Individual::program_str | ( | ) | const |
return program name list
Definition at line 982 of file individual.cc.
void FT::Pop::Individual::save | ( | string | filename | ) |
save individual as a json object.
Definition at line 1050 of file individual.cc.
unsigned int FT::Pop::Individual::set_complexity | ( | ) |
calculate program complexity and return it.
Definition at line 967 of file individual.cc.
void FT::Pop::Individual::set_id | ( | unsigned | i | ) |
Definition at line 112 of file individual.cc.
void FT::Pop::Individual::set_obj | ( | const vector< string > & | objectives | ) |
set obj vector given a string of objective names
Input: objectives: vector of strings naming objectives.
Definition at line 936 of file individual.cc.
void FT::Pop::Individual::set_p | ( | const vector< float > & | weights, |
const float & | fb, | ||
const bool | softmax_norm = false |
||
) |
set probabilities
Definition at line 124 of file individual.cc.
void FT::Pop::Individual::set_parents | ( | const vector< Individual > & | parents | ) |
set parent ids using parents
Definition at line 114 of file individual.cc.
|
inline |
set parent ids using id values
Definition at line 150 of file individual.h.
void FT::Pop::Individual::set_rank | ( | unsigned | r | ) |
int FT::Pop::Individual::size | ( | ) | const |
return size of program
Definition at line 93 of file individual.cc.
MatrixXf FT::Pop::Individual::state_to_phi | ( | State & | state | ) |
converts program states to output matrices
Definition at line 316 of file individual.cc.
void FT::Pop::Individual::tune | ( | const Data & | d, |
const Parameters & | params | ||
) |
tunes an ML model to the data after transformation
unsigned int FT::Pop::Individual::complexity |
the complexity of the program.
Definition at line 50 of file individual.h.
float FT::Pop::Individual::crowd_dist |
crowding distance on the Pareto front
Definition at line 49 of file individual.h.
unsigned int FT::Pop::Individual::dcounter |
number of individuals this dominates
Definition at line 46 of file individual.h.
unsigned int FT::Pop::Individual::dim |
dimensionality of individual
Definition at line 44 of file individual.h.
vector<unsigned int> FT::Pop::Individual::dominated |
individual indices this dominates
Definition at line 47 of file individual.h.
vector<char> FT::Pop::Individual::dtypes |
the data types of each column of the
Definition at line 51 of file individual.h.
string FT::Pop::Individual::eqn |
equation form of the program
Definition at line 55 of file individual.h.
VectorXf FT::Pop::Individual::error |
training error
Definition at line 36 of file individual.h.
float FT::Pop::Individual::fairness |
aggregate fairness score
Definition at line 40 of file individual.h.
float FT::Pop::Individual::fairness_v |
aggregate validation fairness score
Definition at line 41 of file individual.h.
float FT::Pop::Individual::fitness |
aggregate fitness score
Definition at line 38 of file individual.h.
float FT::Pop::Individual::fitness_v |
aggregate validation fitness score
Definition at line 39 of file individual.h.
unsigned FT::Pop::Individual::id |
tracking id
Definition at line 53 of file individual.h.
shared_ptr<ML> FT::Pop::Individual::ml |
ML model, trained on Phi.
Definition at line 37 of file individual.h.
vector<float> FT::Pop::Individual::obj |
objectives for use with Pareto selection
Definition at line 45 of file individual.h.
vector<float> FT::Pop::Individual::p |
probability of variation of subprograms
Definition at line 43 of file individual.h.
vector<int> FT::Pop::Individual::parent_id |
ids of parents
Definition at line 54 of file individual.h.
MatrixXf FT::Pop::Individual::Phi |
transformation output of program
Definition at line 34 of file individual.h.
NodeVector FT::Pop::Individual::program |
executable data structure
Definition at line 33 of file individual.h.
unsigned int FT::Pop::Individual::rank |
pareto front rank
Definition at line 48 of file individual.h.
vector<float> FT::Pop::Individual::w |
weights from ML training on program output
Definition at line 42 of file individual.h.
VectorXf FT::Pop::Individual::yhat |
current output
Definition at line 35 of file individual.h.