Brush C++ API
A flexible interpretable machine learning framework
Loading...
Searching...
No Matches
Brush::Pop::Population< T > Class Template Reference

#include <population.h>

Collaboration diagram for Brush::Pop::Population< T >:

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 &params)
 initialize population of programs with a starting model and/or from file
 
void init (vector< Individual< T > > &individuals, const Parameters &params)
 
void save (string filename)
 
void load (string filename)
 
int size ()
 returns population size (the effective size of the individuals)
 
vector< size_tget_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_thall_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
 

Detailed Description

template<ProgramType T>
class Brush::Pop::Population< T >

Definition at line 12 of file population.h.

Constructor & Destructor Documentation

◆ Population()

Definition at line 7 of file population.cpp.

◆ ~Population()

template<ProgramType T>
Brush::Pop::Population< T >::~Population ( )
inline

Definition at line 22 of file population.h.

Member Function Documentation

◆ add_offspring_indexes()

template<ProgramType T>
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.

Here is the call graph for this function:

◆ get_island_indexes()

template<ProgramType T>
vector< size_t > Brush::Pop::Population< T >::get_island_indexes ( int island)
inline

Definition at line 38 of file population.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hall_of_fame()

template<ProgramType T>
vector< size_t > Brush::Pop::Population< T >::hall_of_fame ( unsigned rank = 1)

Definition at line 262 of file population.cpp.

Here is the call graph for this function:

◆ init() [1/2]

template<ProgramType T>
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.

Here is the call graph for this function:

◆ init() [2/2]

template<ProgramType T>
void Brush::Pop::Population< T >::init ( vector< Individual< T > > & individuals,
const Parameters & params )

Definition at line 17 of file population.cpp.

Here is the call graph for this function:

◆ load()

template<ProgramType T>
void Brush::Pop::Population< T >::load ( string filename)

Definition at line 115 of file population.cpp.

Here is the call graph for this function:

◆ migrate()

template<ProgramType T>
void Brush::Pop::Population< T >::migrate ( )

Definition at line 292 of file population.cpp.

Here is the call graph for this function:

◆ operator[]() [1/2]

template<ProgramType T>
const Individual< T > & Brush::Pop::Population< T >::operator[] ( size_t i)
inline

Definition at line 48 of file population.h.

Here is the call graph for this function:

◆ operator[]() [2/2]

template<ProgramType T>
const Individual< T > & Brush::Pop::Population< T >::operator[] ( size_t i) const
inline

setting and getting from individuals vector (will ignore islands)

Definition at line 47 of file population.h.

Here is the call graph for this function:

◆ print_models()

template<ProgramType T>
string Brush::Pop::Population< T >::print_models ( string sep = "\n")

return population equations.

Definition at line 211 of file population.cpp.

Here is the call graph for this function:

◆ save()

template<ProgramType T>
void Brush::Pop::Population< T >::save ( string filename)

Definition at line 99 of file population.cpp.

Here is the call graph for this function:

◆ size()

template<ProgramType T>
int Brush::Pop::Population< T >::size ( )
inline

returns population size (the effective size of the individuals)

Definition at line 36 of file population.h.

◆ sorted_front()

template<ProgramType T>
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.

Here is the call graph for this function:

◆ update()

template<ProgramType T>
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.

Here is the call graph for this function:

Member Data Documentation

◆ individuals

template<ProgramType T>
vector<std::shared_ptr<Individual<T> > > Brush::Pop::Population< T >::individuals

Definition at line 18 of file population.h.

◆ island_indexes

template<ProgramType T>
vector<vector<size_t> > Brush::Pop::Population< T >::island_indexes

Definition at line 19 of file population.h.

◆ mig_prob

template<ProgramType T>
float Brush::Pop::Population< T >::mig_prob

Definition at line 16 of file population.h.

◆ num_islands

template<ProgramType T>
int Brush::Pop::Population< T >::num_islands

Definition at line 15 of file population.h.

◆ pop_size

template<ProgramType T>
size_t Brush::Pop::Population< T >::pop_size

Definition at line 14 of file population.h.


The documentation for this class was generated from the following files: