|
Brush C++ API
A flexible interpretable machine learning framework
|
The Engine class represents the core engine of the brush library. More...
#include <engine.h>

Classes | |
| struct | PopSummary |
| summary statistics of a subset of the population (e.g. an island) More... | |
Public Member Functions | |
| Engine () | |
| Engine (Parameters &p, SearchSpace &s) | |
| ~Engine () | |
| void | print_progress (float percentage) |
| void | calculate_stats () |
| void | print_stats (float fraction) |
| Parameters & | get_params () |
| void | set_params (Parameters &p) |
| SearchSpace & | get_search_space () |
| void | set_search_space (SearchSpace &space) |
| bool | get_is_fitted () |
| bool | update_best () |
| updates best score by searching in the population for the individual that best fits the given data | |
| Individual< T > & | get_best_ind () |
| Engine< T > & | fit (Dataset &data) |
| Engine< T > & | fit (const Ref< const ArrayXXf > &X, const Ref< const ArrayXf > &y) |
| auto | predict (const Dataset &data) |
| auto | predict (const Ref< const ArrayXXf > &X) |
| template<ProgramType P = T> requires ((P == PT::BinaryClassifier) || (P == PT::MulticlassClassifier)) | |
| auto | predict_proba (const Dataset &d) |
| template<ProgramType P = T> requires ((P == PT::BinaryClassifier) || (P == PT::MulticlassClassifier)) | |
| auto | predict_proba (const Ref< const ArrayXXf > &X) |
| int | get_archive_size () |
| return archive size | |
| vector< json > | get_archive_as_json () |
| return archive/population as strings | |
| vector< json > | get_population_as_json () |
| void | set_population_from_json (vector< json > pop_vector) |
| vector< Individual< T > > | get_archive () |
| return archive/popularion as individuals ready to use | |
| vector< Individual< T > > | get_population () |
| void | set_population (vector< Individual< T > > pop_vector) |
| void | lock_nodes (int end_depth=0, bool keep_leaves_unlocked=true, bool keep_current_weights=false) |
| void | run (Dataset &d) |
| train the model | |
Public Attributes | |
| Parameters | params |
| hyperparameters of brush, which the user can interact | |
| SearchSpace | ss |
| Individual< T > | best_ind |
| best individual found during training | |
| Archive< T > | archive |
| pareto front archive | |
| Population< T > | pop |
| population of programs | |
| bool | is_fitted = false |
| keeps track of whether fit was called | |
Private Member Functions | |
| PopSummary | summarize (const vector< size_t > &indices) const |
| void | open_logs () |
| void | log_stats (unsigned stall_count, const SimplificationRecords &simplifications) |
| void | close_logs () |
| void | init () |
| initialize Feat object for fitting. | |
| void | set_is_fitted (bool f) |
| set flag indicating whether fit has been called | |
Private Attributes | |
| Selection< T > | selector |
| selection algorithm | |
| Evaluation< T > | evaluator |
| evaluation code | |
| Selection< T > | survivor |
| survival algorithm | |
| Log_Stats | stats |
| runtime stats | |
| Timer | timer |
| start time of training | |
| string | run_id |
| identifies the rows of one call to fit | |
| Util::CsvWriter | log_generations |
| <logfile> | |
| Util::CsvWriter | log_islands |
| <logfile>_islands.csv | |
| Util::CsvWriter | log_simplifications |
| <logfile>_simplifications.csv | |
The Engine class represents the core engine of the brush library.
It encapsulates the functionality for training and predicting with programs in a genetic programming framework. The Engine class manages the population of programs, selection algorithms, evaluation code, variation operators, and survival algorithms. It also provides methods for training the model, making predictions, and accessing runtime statistics.
The Engine class is parameterized by the program type T, which determines the type of programs that can be evolved and evaluated by the engine.
|
inline |
|
inline |
|
inline |
| void Brush::Engine< T >::calculate_stats | ( | ) |
Definition at line 147 of file engine.cpp.


|
private |
|
inline |
|
inline |
| vector< Individual< T > > Brush::Engine< T >::get_archive | ( | ) |
return archive/popularion as individuals ready to use
Definition at line 385 of file engine.cpp.
| vector< json > Brush::Engine< T >::get_archive_as_json | ( | ) |
return archive/population as strings
Definition at line 348 of file engine.cpp.

|
inline |
|
inline |
|
inline |
|
inline |
| vector< Individual< T > > Brush::Engine< T >::get_population | ( | ) |
Definition at line 396 of file engine.cpp.
| vector< json > Brush::Engine< T >::get_population_as_json | ( | ) |
|
inline |
|
private |
initialize Feat object for fitting.
Definition at line 21 of file engine.cpp.


| void Brush::Engine< T >::lock_nodes | ( | int | end_depth = 0, |
| bool | keep_leaves_unlocked = true, | ||
| bool | keep_current_weights = false ) |
Definition at line 459 of file engine.cpp.
|
private |
Definition at line 247 of file engine.cpp.


|
private |
|
inline |
|
inline |
|
inline |
|
inline |
| void Brush::Engine< T >::print_progress | ( | float | percentage | ) |
| void Brush::Engine< T >::print_stats | ( | float | fraction | ) |
| void Brush::Engine< T >::run | ( | Dataset & | d | ) |
train the model
Definition at line 531 of file engine.cpp.

|
inlineprivate |
|
inline |
| void Brush::Engine< T >::set_population | ( | vector< Individual< T > > | pop_vector | ) |
| void Brush::Engine< T >::set_population_from_json | ( | vector< json > | pop_vector | ) |
|
inline |
|
private |
Definition at line 57 of file engine.cpp.


| bool Brush::Engine< T >::update_best | ( | ) |
updates best score by searching in the population for the individual that best fits the given data
Definition at line 479 of file engine.cpp.

| Archive<T> Brush::Engine< T >::archive |
| Individual<T> Brush::Engine< T >::best_ind |
|
private |
| bool Brush::Engine< T >::is_fitted = false |
|
private |
|
private |
|
private |
| Parameters Brush::Engine< T >::params |
| Population<T> Brush::Engine< T >::pop |
|
private |
|
private |
| SearchSpace Brush::Engine< T >::ss |
|
private |
|
private |
|
private |