Evaluation#

template<ProgramType T>
class Evaluation#

Class for evaluating the fitness of individuals in a population.

Public Functions

inline Evaluation()#

Constructor for Evaluation class.

Initializes the scorer based on the program type.

inline ~Evaluation()#
inline void set_scorer(string scorer)#

Set the scorer for evaluation.

Parameters:

scorer – The scorer to be set.

inline string get_scorer()#

Get the current scorer.

Returns:

The current scorer.

void update_fitness(Population<T> &pop, int island, const Dataset &data, const Parameters &params, bool fit = true, bool validation = false)#

Update the fitness of individuals in a population.

Parameters:
  • pop – The population to update.

  • island – The island index.

  • data – The dataset for evaluation.

  • params – The parameters for evaluation.

  • fit – Flag indicating whether to update fitness.

  • validation – Flag indicating whether to perform validation.

void assign_fit(Individual<T> &ind, const Dataset &data, const Parameters &params, bool val = false)#

Assign fitness to an individual.

Parameters:
  • ind – The individual to assign fitness to.

  • data – The dataset for evaluation.

  • params – The parameters for evaluation.

  • val – Flag indicating whether it is validation fitness.

Public Members

Scorer<T> S#
template<ProgramType P>
class Scorer#

Public Functions

inline Scorer(string scorer = "mse")#
inline void set_scorer(string scorer)#
inline string get_scorer()#
inline float score(const VectorXf &y_true, const VectorXf &y_pred, VectorXf &loss, const vector<float> &w)#
inline float score(Individual<P> &ind, Dataset &data, VectorXf &loss, const Parameters &params)#

Public Members

std::map<string, funcPointer> score_hash#
string scorer#