30 start = individuals.size()/2;
34 for (
unsigned i = start;
i<individuals.size(); ++
i)
51 shared_ptr<CLabels> yhat = ind.
predict(d);
54 +
", eqn: " + ind.
get_eqn(), 3);
88 if (offspring) start = individuals.size()/2;
101 #pragma omp parallel for
102 for (
unsigned i = start;
i<individuals.size(); ++
i)
113 backprop.
run(ind, d, params);
121 shared_ptr<CLabels> yhat = ind.
fit(d,params,pass);
124 +
", eqn: " + ind.
get_eqn(), 3);
142 bool updated =
false;
143 shared_ptr<CLabels> yhat2 = hc.
run(ind, d, params,
158 const shared_ptr<CLabels>& yhat,
const Data& d,
182 cout <<
"fairness is " << fairness <<
"...\n";
201 float base_score,
bool use_alpha)
213 for (
const auto& lvl : pl.second)
215 x_idx = (d.
X.row(pl.first).array() == lvl);
216 float len_g = x_idx.count();
218 alpha = len_g/d.
X.cols();
221 float Beta = fabs(base_score -
222 x_idx.select(loss,0).sum()/len_g);
226 avg_score += alpha * Beta;
data holding X, y, and Z data
map< int, vector< float > > protect_levels
void assign_fit(Individual &ind, const shared_ptr< CLabels > &yhat, const Data &d, const Parameters ¶ms, bool val=false)
assign fitness to an individual.
Evaluation(string scorer="")
float marginal_fairness(VectorXf &loss, const Data &d, float base_score, bool use_alpha=false)
void validation(vector< Individual > &individuals, const Data &d, const Parameters ¶ms, bool offspring=false)
validation of population.
void fitness(vector< Individual > &individuals, const Data &d, const Parameters ¶ms, bool offspring=false)
fitness of population.
float score(const VectorXf &y_true, const shared_ptr< CLabels > &yhat, VectorXf &loss, const vector< float > &w)
void set_scorer(string scorer)
void run(Individual &ind, const Data &d, const Parameters ¶ms)
adapt weights
shared_ptr< CLabels > run(Individual &ind, Data d, const Parameters ¶ms, bool &updated)
adapt weights
individual programs in the population
float fairness
aggregate fairness score
string get_eqn()
return symbolic representation of program
float fitness
aggregate fitness score
shared_ptr< CLabels > predict(const Data &d)
shared_ptr< CLabels > fit(const Data &d, const Parameters ¶ms, bool &pass)
fits an ML model to the data after transformation
VectorXf error
training error
float fairness_v
aggregate validation fairness score
float fitness_v
aggregate validation fitness score
string log(string m, int v, string sep="\n") const
print message with verbosity control.
Eigen::Array< bool, Eigen::Dynamic, 1 > ArrayXb
ArrayXb isinf(const ArrayXf &x)
returns true for elements of x that are infinite
ArrayXb isnan(const ArrayXf &x)
returns true for elements of x that are NaN
std::string to_string(const T &value)
template function to convert objects to string for logging
holds the hyperparameters for Feat.
bool backprop
turns on backpropagation
vector< float > class_weights
weights for each class
bool hillclimb
turns on parameter hill climbing
HC hc
stochastic hill climbing parameters
string scorer_
actual loss function used, determined by scorer