Individual and Fitness#
-
template<ProgramType T>
class Individual# Public Functions
-
inline Individual()#
-
inline void init(SearchSpace &ss, const Parameters ¶ms)#
-
inline Individual<T> &fit(const Dataset &data)#
-
inline Individual<T> &fit(const Ref<const ArrayXXf> &X, const Ref<const ArrayXf> &y)#
-
inline auto predict(const Dataset &data)#
-
inline auto predict(const Ref<const ArrayXXf> &X)#
-
inline bool get_is_fitted() const#
-
inline unsigned int get_size() const#
-
inline unsigned int get_depth() const#
-
inline unsigned int get_complexity() const#
-
inline string get_model(string fmt = "compact", bool pretty = false)#
-
inline string get_dot_model(string extras = "")#
-
inline void set_id(unsigned i)#
-
inline void set_parents(const vector<Individual<T>> &parents)#
-
inline void set_parents(const vector<unsigned> &parents)#
set parent ids using parents
-
inline vector<string> get_objectives() const#
-
inline void set_objectives(vector<string> objs)#
Public Members
-
bool is_fitted_ = false#
-
unsigned id#
tracking id
-
vector<unsigned> parent_id#
ids of parents
-
VectorXf error#
training error (used in lexicase selectors)
-
vector<string> objectives#
objectives for use with Pareto selection
Public Static Attributes
-
static std::map<std::string, float> weightsMap = {{"complexity", -1.0}, {"size", -1.0}, {"mse", -1.0}, {"log", -1.0}, {"multi_log", -1.0}, {"average_precision_score", +1.0}, {"accuracy", +1.0}, {"error", -1.0}}#
set parent ids using id values
-
inline Individual()#
-
struct Fitness#
Represents the fitness of an individual in the Brush namespace.
The
Fitness
struct stores various attributes related to the fitness of an individual in the Brush namespace. It includes the aggregate loss score, aggregate validation loss score, complexity, size, depth, dominance counter, dominated individuals, Pareto front rank, crowding distance on the Pareto front, weighted values, and weights.The struct provides getter and setter methods for accessing and modifying these attributes. It also includes methods for calculating the hash value, setting values, clearing values, checking validity, and performing comparison operations.
Additionally, there are methods for converting the
Fitness
object to JSON format and vice versa.Public Functions
-
inline void set_dominated(vector<unsigned int> &dom)#
-
inline vector<unsigned int> get_dominated() const#
-
inline void set_loss(float f)#
-
inline float get_loss() const#
-
inline void set_loss_v(float f_v)#
-
inline float get_loss_v() const#
-
inline void set_size(unsigned int new_s)#
-
inline unsigned int get_size() const#
-
inline void set_complexity(unsigned int new_c)#
-
inline unsigned int get_complexity() const#
-
inline void set_depth(unsigned int new_d)#
-
inline unsigned int get_depth() const#
-
inline void set_dcounter(unsigned int d)#
-
inline unsigned int get_dcounter() const#
-
inline void set_rank(unsigned r)#
-
inline size_t get_rank() const#
-
inline void set_crowding_dist(float cd)#
-
inline float get_crowding_dist() const#
-
inline Fitness(const vector<float> &w = {})#
-
inline size_t hash() const#
-
inline void set_weights(vector<float> &w)#
-
inline vector<float> get_weights() const#
-
inline vector<float> get_values() const#
-
inline vector<float> get_wvalues() const#
-
inline void set_values(vector<float> &v)#
-
inline void clearValues()#
-
inline bool valid() const#
-
inline std::string toString() const#
-
inline std::string repr() const#
Public Members
-
float loss#
aggregate loss score
-
float loss_v#
aggregate validation loss score
-
unsigned int complexity#
-
unsigned int size#
-
unsigned int depth#
-
unsigned int dcounter#
number of individuals this dominates
-
vector<unsigned int> dominated#
individual indices this dominates
-
unsigned int rank#
pareto front rank
-
float crowding_dist#
crowding distance on the Pareto front
-
vector<float> values#
-
vector<float> weights#
-
vector<float> wvalues#
-
inline void set_dominated(vector<unsigned int> &dom)#