Brush C++ API
A flexible interpretable machine learning framework
|
#include <population.h>
Classes | |
struct | SameFitComplexity |
check for same fitness and complexity to filter uniqueness. More... | |
struct | SortComplexity |
Sort each island in increasing complexity. This is not thread safe. I should set complexities of the whole population before calling it, and use get_complexity instead. More... | |
Public Member Functions | |
Population () | |
~Population () | |
void | init (SearchSpace &ss, const Parameters ¶ms) |
initialize population of programs with a starting model and/or from file | |
void | init (vector< Individual< T > > &individuals, const Parameters ¶ms) |
void | save (string filename) |
void | load (string filename) |
int | size () |
returns population size (the effective size of the individuals) | |
vector< size_t > | get_island_indexes (int island) |
void | add_offspring_indexes (int island) |
update individual vector size, distributing the expressions in num_islands | |
void | update (vector< vector< size_t > > survivors) |
reduce programs to the indices in survivors. Not thread safe,as it removes elements | |
const Individual< T > & | operator[] (size_t i) const |
setting and getting from individuals vector (will ignore islands) | |
const Individual< T > & | operator[] (size_t i) |
string | print_models (string sep="\n") |
return population equations. | |
vector< vector< size_t > > | sorted_front (unsigned rank=1) |
return complexity-sorted Pareto front indices for each island | |
vector< size_t > | hall_of_fame (unsigned rank=1) |
void | migrate () |
Public Attributes | |
size_t | pop_size |
int | num_islands |
float | mig_prob |
vector< std::shared_ptr< Individual< T > > > | individuals |
vector< vector< size_t > > | island_indexes |
Definition at line 12 of file population.h.
Brush::Pop::Population< T >::Population | ( | ) |
Definition at line 7 of file population.cpp.
|
inline |
Definition at line 22 of file population.h.
void Brush::Pop::Population< T >::add_offspring_indexes | ( | int | island | ) |
update individual vector size, distributing the expressions in num_islands
update individual vector size and island indexes
Definition at line 136 of file population.cpp.
|
inline |
Definition at line 38 of file population.h.
vector< size_t > Brush::Pop::Population< T >::hall_of_fame | ( | unsigned | rank = 1 | ) |
void Brush::Pop::Population< T >::init | ( | SearchSpace & | ss, |
const Parameters & | params ) |
initialize population of programs with a starting model and/or from file
Definition at line 60 of file population.cpp.
void Brush::Pop::Population< T >::init | ( | vector< Individual< T > > & | individuals, |
const Parameters & | params ) |
void Brush::Pop::Population< T >::load | ( | string | filename | ) |
void Brush::Pop::Population< T >::migrate | ( | ) |
|
inline |
|
inline |
setting and getting from individuals vector (will ignore islands)
Definition at line 47 of file population.h.
string Brush::Pop::Population< T >::print_models | ( | string | sep = "\n" | ) |
return population equations.
Definition at line 211 of file population.cpp.
void Brush::Pop::Population< T >::save | ( | string | filename | ) |
|
inline |
returns population size (the effective size of the individuals)
Definition at line 36 of file population.h.
vector< vector< size_t > > Brush::Pop::Population< T >::sorted_front | ( | unsigned | rank = 1 | ) |
return complexity-sorted Pareto front indices for each island
Definition at line 231 of file population.cpp.
void Brush::Pop::Population< T >::update | ( | vector< vector< size_t > > | survivors | ) |
reduce programs to the indices in survivors. Not thread safe,as it removes elements
Definition at line 159 of file population.cpp.
vector<std::shared_ptr<Individual<T> > > Brush::Pop::Population< T >::individuals |
Definition at line 18 of file population.h.
vector<vector<size_t> > Brush::Pop::Population< T >::island_indexes |
Definition at line 19 of file population.h.
float Brush::Pop::Population< T >::mig_prob |
Definition at line 16 of file population.h.
int Brush::Pop::Population< T >::num_islands |
Definition at line 15 of file population.h.
size_t Brush::Pop::Population< T >::pop_size |
Definition at line 14 of file population.h.