Brush C++ API
A flexible interpretable machine learning framework
|
The Engine
class represents the core engine of the brush library.
More...
#include <engine.h>
Public Member Functions | |
Engine () | |
Engine (Parameters &p, SearchSpace &s) | |
~Engine () | |
void | print_progress (float percentage) |
void | calculate_stats () |
void | print_stats (std::ofstream &log, float fraction) |
void | log_stats (std::ofstream &log) |
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) |
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 | |
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 | |
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 | ( | ) |
|
inline |
|
inline |
vector< Individual< T > > Brush::Engine< T >::get_archive | ( | ) |
return archive/popularion as individuals ready to use
Definition at line 218 of file engine.cpp.
vector< json > Brush::Engine< T >::get_archive_as_json | ( | ) |
return archive/population as strings
Definition at line 182 of file engine.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
vector< Individual< T > > Brush::Engine< T >::get_population | ( | ) |
Definition at line 229 of file engine.cpp.
vector< json > Brush::Engine< T >::get_population_as_json | ( | ) |
|
inline |
|
private |
initialize Feat object for fitting.
Definition at line 16 of file engine.cpp.
void Brush::Engine< T >::lock_nodes | ( | int | end_depth = 0, |
bool | keep_leaves_unlocked = true ) |
Definition at line 291 of file engine.cpp.
void Brush::Engine< T >::log_stats | ( | std::ofstream & | log | ) |
|
inline |
|
inline |
|
inline |
|
inline |
void Brush::Engine< T >::print_progress | ( | float | percentage | ) |
void Brush::Engine< T >::print_stats | ( | std::ofstream & | log, |
float | fraction ) |
void Brush::Engine< T >::run | ( | Dataset & | d | ) |
train the model
Definition at line 352 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 |
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 306 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 |
Parameters Brush::Engine< T >::params |
Population<T> Brush::Engine< T >::pop |
|
private |
SearchSpace Brush::Engine< T >::ss |
|
private |
|
private |
|
private |