XCSF  1.4.7
XCSF learning classifier system
XCS Class Reference

Python XCSF class data structure. More...

Collaboration diagram for XCS:
[legend]

Public Member Functions

 XCS ()
 Default Constructor. More...
 
 XCS (py::kwargs kwargs)
 Constructor. More...
 
void reset (void)
 Resets basic constructor variables. More...
 
size_t save (const char *filename)
 Writes the entire current state of XCSF to a file. More...
 
size_t load (const char *filename)
 Reads the entire current state of XCSF from a file. More...
 
void store (void)
 Stores the current population in memory for later retrieval. More...
 
void retrieve (void)
 Retrieves the stored population, setting it as current. More...
 
void print_params (void)
 Prints the XCSF parameters and their current values. More...
 
void pred_expand (void)
 Inserts a new hidden layer before the output layer within all prediction neural networks in the population. More...
 
void ae_to_classifier (const int y_dim, const int n_del)
 Switches from autoencoding to classification. More...
 
void print_pset (const bool condition, const bool action, const bool prediction)
 Prints the current population. More...
 
double fit (const py::array_t< double > input, const int action, const double reward)
 Creates/updates an action set for a given (state, action, reward). More...
 
void init_trial (void)
 Initialises a reinforcement learning trial. More...
 
void end_trial (void)
 Frees memory used by a reinforcement learning trial. More...
 
void init_step (void)
 Initialises a step in a reinforcement learning trial. More...
 
void end_step (void)
 Ends a step in a reinforcement learning trial. More...
 
int decision (const py::array_t< double > input, const bool explore)
 Selects an action to perform in a reinforcement learning problem. More...
 
void update (const double reward, const bool done)
 Creates the action set using the previously selected action, updates the classifiers, and runs the EA on explore steps. More...
 
double error (const double reward, const bool done, const double max_p)
 Returns the reinforcement learning system prediction error. More...
 
void load_input (struct Input *data, const py::array_t< double > X, const py::array_t< double > Y)
 Loads an input data structure for fitting. More...
 
void print_status ()
 Prints the current performance metrics. More...
 
void update_metrics (const double train, const double val, const int n_trials)
 Updates performance metrics. More...
 
void load_validation_data (py::kwargs kwargs)
 Loads validation data if present in kwargs. More...
 
bool callbacks_run (py::list callbacks)
 Executes callbacks and returns whether to terminate. More...
 
void callbacks_finish (py::list callbacks)
 Executes callback finish. More...
 
XCSfit (const py::array_t< double > X_train, const py::array_t< double > y_train, const bool shuffle, const bool warm_start, const bool verbose, py::object callbacks, py::kwargs kwargs)
 Executes MAX_TRIALS number of XCSF learning iterations using the provided training data. More...
 
double * get_cover (const py::array_t< double > cover)
 Returns the values specified in the cover array. More...
 
void set_cover (const py::object &cover)
 Sets the XCSF cover array to values given, or zeros. More...
 
py::array_t< double > predict (const py::array_t< double > X, const py::object &cover)
 Returns the XCSF prediction array for the provided input. More...
 
double score (const py::array_t< double > X, const py::array_t< double > Y, const int N, const py::object &cover)
 Returns the error using N random samples from the provided data. More...
 
py::bytes serialize () const
 Implements pickle file writing. More...
 
double error (void)
 Returns the current system error. More...
 
py::dict get_metrics (void)
 
int get_pset_size (void)
 
int get_pset_num (void)
 
int get_time (void)
 
double get_pset_mean_cond_size (void)
 
double get_pset_mean_pred_size (void)
 
double get_pset_mean_pred_eta (const int layer)
 
double get_pset_mean_pred_neurons (const int layer)
 
double get_pset_mean_pred_connections (const int layer)
 
double get_pset_mean_pred_layers (void)
 
double get_pset_mean_cond_connections (const int layer)
 
double get_pset_mean_cond_neurons (const int layer)
 
double get_pset_mean_cond_layers (void)
 
double get_mset_size (void)
 
double get_aset_size (void)
 
double get_mfrac (void)
 
const char * json_export (const bool condition, const bool action, const bool prediction)
 Returns a JSON formatted string representing the population set. More...
 
void update_params ()
 Updates the Python object's parameter dictionary. More...
 
py::dict get_params (const bool deep)
 Returns a dictionary of parameters. More...
 
XCSset_params (py::kwargs kwargs)
 Sets parameter values. More...
 
py::dict internal_params ()
 Returns a dictionary of the internal parameters. More...
 
void json_insert_cl (const std::string &json_str)
 Creates a classifier from JSON and inserts into the population. More...
 
void json_insert (const std::string &json_str)
 Creates classifiers from JSON and inserts into the population. More...
 
void json_write (const std::string &filename)
 Writes the current population set to a file in JSON. More...
 
void json_read (const std::string &filename)
 Reads classifiers from a JSON file and adds to the population. More...
 

Static Public Member Functions

static XCS deserialize (const py::bytes &state)
 Implements pickle file reading. More...
 

Private Attributes

struct XCSF xcs
 XCSF data structure. More...
 
double * state
 Current input state for RL. More...
 
int action
 Current action for RL. More...
 
double payoff
 Current reward for RL. More...
 
struct Inputtrain_data
 Training data for supervised learning. More...
 
struct Inputtest_data
 Test data for supervised learning. More...
 
struct Inputval_data
 Validation data. More...
 
py::dict params
 Dictionary of parameters and their values. More...
 
py::list metric_train
 
py::list metric_val
 
py::list metric_trial
 
py::list metric_psize
 
py::list metric_msize
 
py::list metric_mfrac
 
int metric_counter
 

Detailed Description

Python XCSF class data structure.

Definition at line 64 of file pybind_wrapper.cpp.

Constructor & Destructor Documentation

◆ XCS() [1/2]

XCS::XCS ( )
inline

Default Constructor.

Definition at line 87 of file pybind_wrapper.cpp.

References reset(), xcs, and xcsf_init().

Referenced by deserialize().

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

◆ XCS() [2/2]

XCS::XCS ( py::kwargs  kwargs)
inlineexplicit

Constructor.

Parameters
[in]kwargsParameters and their values.

Definition at line 97 of file pybind_wrapper.cpp.

References reset(), set_params(), xcs, and xcsf_init().

Here is the call graph for this function:

Member Function Documentation

◆ ae_to_classifier()

void XCS::ae_to_classifier ( const int  y_dim,
const int  n_del 
)
inline

Switches from autoencoding to classification.

Parameters
[in]y_dimThe output dimension (i.e., the number of classes).
[in]n_delThe number of hidden layers to remove.

Definition at line 198 of file pybind_wrapper.cpp.

References xcs, xcsf_ae_to_classifier(), and Input::y_dim.

Here is the call graph for this function:

◆ callbacks_finish()

void XCS::callbacks_finish ( py::list  callbacks)
inline

Executes callback finish.

Parameters
[in]callbacksThe callbacks to perform.

Definition at line 474 of file pybind_wrapper.cpp.

References Callback::finish(), and xcs.

Referenced by fit().

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

◆ callbacks_run()

bool XCS::callbacks_run ( py::list  callbacks)
inline

Executes callbacks and returns whether to terminate.

Parameters
[in]callbacksThe callbacks to perform.
Returns
Whether to terminate early.

Definition at line 452 of file pybind_wrapper.cpp.

References get_metrics(), Callback::run(), and xcs.

Referenced by fit().

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

◆ decision()

int XCS::decision ( const py::array_t< double >  input,
const bool  explore 
)
inline

Selects an action to perform in a reinforcement learning problem.

Constructs the match set and selects an action to perform.

Parameters
[in]inputThe input state.
[in]exploreWhether this is an exploration step.
Returns
The selected action.

Definition at line 287 of file pybind_wrapper.cpp.

References action, error(), param_set_explore(), state, XCSF::x_dim, xcs, and xcs_rl_decision().

Here is the call graph for this function:

◆ deserialize()

static XCS XCS::deserialize ( const py::bytes &  state)
inlinestatic

Implements pickle file reading.

Uses a temporary binary file.

Parameters
stateThe pickled state of a saved XCSF.

Definition at line 659 of file pybind_wrapper.cpp.

References state, XCS(), xcs, and xcsf_load().

Here is the call graph for this function:

◆ end_step()

void XCS::end_step ( void  )
inline

Ends a step in a reinforcement learning trial.

Definition at line 274 of file pybind_wrapper.cpp.

References action, payoff, state, xcs, and xcs_rl_end_step().

Here is the call graph for this function:

◆ end_trial()

void XCS::end_trial ( void  )
inline

Frees memory used by a reinforcement learning trial.

Definition at line 256 of file pybind_wrapper.cpp.

References xcs, and xcs_rl_end_trial().

Here is the call graph for this function:

◆ error() [1/2]

double XCS::error ( const double  reward,
const bool  done,
const double  max_p 
)
inline

Returns the reinforcement learning system prediction error.

Parameters
[in]rewardThe current reward.
[in]doneWhether the environment is in a terminal state.
[in]max_pThe maximum payoff in the environment.
Returns
The prediction error.

Definition at line 322 of file pybind_wrapper.cpp.

References action, payoff, xcs, and xcs_rl_error().

Here is the call graph for this function:

◆ error() [2/2]

double XCS::error ( void  )
inline

Returns the current system error.

Returns
Moving average of the system error, updated with step size BETA.

Definition at line 688 of file pybind_wrapper.cpp.

References XCSF::error, and xcs.

Referenced by decision(), fit(), load_input(), and predict().

Here is the caller graph for this function:

◆ fit() [1/2]

double XCS::fit ( const py::array_t< double >  input,
const int  action,
const double  reward 
)
inline

Creates/updates an action set for a given (state, action, reward).

Parameters
[in]inputThe input state to match.
[in]actionThe selected action.
[in]rewardThe reward for having performed the action.
Returns
The prediction error.

Definition at line 225 of file pybind_wrapper.cpp.

References action, error(), XCSF::n_actions, state, XCSF::x_dim, xcs, and xcs_rl_fit().

Here is the call graph for this function:

◆ fit() [2/2]

XCS& XCS::fit ( const py::array_t< double >  X_train,
const py::array_t< double >  y_train,
const bool  shuffle,
const bool  warm_start,
const bool  verbose,
py::object  callbacks,
py::kwargs  kwargs 
)
inline

Executes MAX_TRIALS number of XCSF learning iterations using the provided training data.

Parameters
[in]X_trainThe input values to use for training.
[in]y_trainThe true output values to use for training.
[in]shuffleWhether to randomise the instances during training.
[in]warm_startWhether to continue with existing population.
[in]verboseWhether to print learning metrics.
[in]callbacksList of Callback objects or None.
[in]kwargsKeyword arguments.
Returns
The fitted XCSF model.

Definition at line 499 of file pybind_wrapper.cpp.

References callbacks_finish(), callbacks_run(), XCSF::cover, load_input(), load_validation_data(), XCSF::MAX_TRIALS, XCSF::PERF_TRIALS, print_status(), train_data, update_metrics(), val_data, xcs, xcs_supervised_fit(), xcs_supervised_score(), xcsf_free(), and xcsf_init().

Here is the call graph for this function:

◆ get_aset_size()

double XCS::get_aset_size ( void  )
inline

Definition at line 785 of file pybind_wrapper.cpp.

References XCSF::aset_size, and xcs.

◆ get_cover()

double* XCS::get_cover ( const py::array_t< double >  cover)
inline

Returns the values specified in the cover array.

Parameters
[in]coverThe values to return for covering.
Returns
The cover array values.

Definition at line 543 of file pybind_wrapper.cpp.

References xcs, and XCSF::y_dim.

Referenced by set_cover().

Here is the caller graph for this function:

◆ get_metrics()

py::dict XCS::get_metrics ( void  )
inline

Definition at line 694 of file pybind_wrapper.cpp.

References metric_mfrac, metric_msize, metric_psize, metric_train, metric_trial, and metric_val.

Referenced by callbacks_run().

Here is the caller graph for this function:

◆ get_mfrac()

double XCS::get_mfrac ( void  )
inline

Definition at line 791 of file pybind_wrapper.cpp.

References XCSF::mfrac, and xcs.

◆ get_mset_size()

double XCS::get_mset_size ( void  )
inline

Definition at line 779 of file pybind_wrapper.cpp.

References XCSF::mset_size, and xcs.

◆ get_params()

py::dict XCS::get_params ( const bool  deep)
inline

Returns a dictionary of parameters.

Parameters
deepFor sklearn compatibility.
Returns
External parameter dictionary.

Definition at line 842 of file pybind_wrapper.cpp.

References params.

◆ get_pset_mean_cond_connections()

double XCS::get_pset_mean_cond_connections ( const int  layer)
inline

Definition at line 761 of file pybind_wrapper.cpp.

References clset_mean_cond_connections(), XCSF::pset, and xcs.

Here is the call graph for this function:

◆ get_pset_mean_cond_layers()

double XCS::get_pset_mean_cond_layers ( void  )
inline

Definition at line 773 of file pybind_wrapper.cpp.

References clset_mean_cond_layers(), XCSF::pset, and xcs.

Here is the call graph for this function:

◆ get_pset_mean_cond_neurons()

double XCS::get_pset_mean_cond_neurons ( const int  layer)
inline

Definition at line 767 of file pybind_wrapper.cpp.

References clset_mean_cond_neurons(), XCSF::pset, and xcs.

Here is the call graph for this function:

◆ get_pset_mean_cond_size()

double XCS::get_pset_mean_cond_size ( void  )
inline

Definition at line 725 of file pybind_wrapper.cpp.

References clset_mean_cond_size(), XCSF::pset, and xcs.

Here is the call graph for this function:

◆ get_pset_mean_pred_connections()

double XCS::get_pset_mean_pred_connections ( const int  layer)
inline

Definition at line 749 of file pybind_wrapper.cpp.

References clset_mean_pred_connections(), XCSF::pset, and xcs.

Here is the call graph for this function:

◆ get_pset_mean_pred_eta()

double XCS::get_pset_mean_pred_eta ( const int  layer)
inline

Definition at line 737 of file pybind_wrapper.cpp.

References clset_mean_pred_eta(), XCSF::pset, and xcs.

Here is the call graph for this function:

◆ get_pset_mean_pred_layers()

double XCS::get_pset_mean_pred_layers ( void  )
inline

Definition at line 755 of file pybind_wrapper.cpp.

References clset_mean_pred_layers(), XCSF::pset, and xcs.

Here is the call graph for this function:

◆ get_pset_mean_pred_neurons()

double XCS::get_pset_mean_pred_neurons ( const int  layer)
inline

Definition at line 743 of file pybind_wrapper.cpp.

References clset_mean_pred_neurons(), XCSF::pset, and xcs.

Here is the call graph for this function:

◆ get_pset_mean_pred_size()

double XCS::get_pset_mean_pred_size ( void  )
inline

Definition at line 731 of file pybind_wrapper.cpp.

References clset_mean_pred_size(), XCSF::pset, and xcs.

Here is the call graph for this function:

◆ get_pset_num()

int XCS::get_pset_num ( void  )
inline

Definition at line 713 of file pybind_wrapper.cpp.

References Set::num, XCSF::pset, and xcs.

◆ get_pset_size()

int XCS::get_pset_size ( void  )
inline

Definition at line 707 of file pybind_wrapper.cpp.

References XCSF::pset, Set::size, and xcs.

◆ get_time()

int XCS::get_time ( void  )
inline

Definition at line 719 of file pybind_wrapper.cpp.

References XCSF::time, and xcs.

◆ init_step()

void XCS::init_step ( void  )
inline

Initialises a step in a reinforcement learning trial.

Definition at line 265 of file pybind_wrapper.cpp.

References xcs, and xcs_rl_init_step().

Here is the call graph for this function:

◆ init_trial()

void XCS::init_trial ( void  )
inline

Initialises a reinforcement learning trial.

Definition at line 247 of file pybind_wrapper.cpp.

References xcs, and xcs_rl_init_trial().

Here is the call graph for this function:

◆ internal_params()

py::dict XCS::internal_params ( )
inline

Returns a dictionary of the internal parameters.

Returns
Internal parameter dictionary.

Definition at line 882 of file pybind_wrapper.cpp.

References param_json_export(), and xcs.

Here is the call graph for this function:

◆ json_export()

const char* XCS::json_export ( const bool  condition,
const bool  action,
const bool  prediction 
)
inline

Returns a JSON formatted string representing the population set.

Parameters
[in]conditionWhether to return the condition.
[in]actionWhether to return the action.
[in]predictionWhether to return the prediction.
Returns
String encoded in json format.

Definition at line 806 of file pybind_wrapper.cpp.

References action, clset_json_export(), Set::list, XCSF::pset, and xcs.

Referenced by json_write().

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

◆ json_insert()

void XCS::json_insert ( const std::string &  json_str)
inline

Creates classifiers from JSON and inserts into the population.

Parameters
[in]json_strJSON formatted string representing a classifier.

Definition at line 909 of file pybind_wrapper.cpp.

References clset_json_insert(), and xcs.

Referenced by json_read().

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

◆ json_insert_cl()

void XCS::json_insert_cl ( const std::string &  json_str)
inline

Creates a classifier from JSON and inserts into the population.

Parameters
[in]json_strJSON formatted string representing a classifier.

Definition at line 896 of file pybind_wrapper.cpp.

References clset_json_insert_cl(), utils_json_parse_check(), and xcs.

Here is the call graph for this function:

◆ json_read()

void XCS::json_read ( const std::string &  filename)
inline

Reads classifiers from a JSON file and adds to the population.

Parameters
[in]filenameName of the input file.

Definition at line 931 of file pybind_wrapper.cpp.

References json_insert().

Here is the call graph for this function:

◆ json_write()

void XCS::json_write ( const std::string &  filename)
inline

Writes the current population set to a file in JSON.

Parameters
[in]filenameName of the output file.

Definition at line 919 of file pybind_wrapper.cpp.

References json_export().

Here is the call graph for this function:

◆ load()

size_t XCS::load ( const char *  filename)
inline

Reads the entire current state of XCSF from a file.

Parameters
[in]filenameString containing the name of the input file.
Returns
The total number of elements read.

Definition at line 148 of file pybind_wrapper.cpp.

References update_params(), xcs, and xcsf_load().

Here is the call graph for this function:

◆ load_input()

void XCS::load_input ( struct Input data,
const py::array_t< double >  X,
const py::array_t< double >  Y 
)
inline

Loads an input data structure for fitting.

Parameters
[in,out]dataInput data structure used to point to the data.
[in]XVector of features with shape (n_samples, x_dim).
[in]YVector of truth values with shape (n_samples, y_dim).

Definition at line 337 of file pybind_wrapper.cpp.

References error(), Input::n_samples, Input::x, XCSF::x_dim, Input::x_dim, xcs, Input::y, XCSF::y_dim, and Input::y_dim.

Referenced by fit(), load_validation_data(), and score().

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

◆ load_validation_data()

void XCS::load_validation_data ( py::kwargs  kwargs)
inline

Loads validation data if present in kwargs.

Parameters
[in]kwargsParameters and their values.

Definition at line 426 of file pybind_wrapper.cpp.

References XCSF::cover, load_input(), XCSF::pa_size, test_data, val_data, and xcs.

Referenced by fit().

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

◆ pred_expand()

void XCS::pred_expand ( void  )
inline

Inserts a new hidden layer before the output layer within all prediction neural networks in the population.

Definition at line 187 of file pybind_wrapper.cpp.

References xcs, and xcsf_pred_expand().

Here is the call graph for this function:

◆ predict()

py::array_t<double> XCS::predict ( const py::array_t< double >  X,
const py::object &  cover 
)
inline

Returns the XCSF prediction array for the provided input.

Parameters
[in]XThe input variables.
[in]coverIf the match set is empty, the prediction array will be set to this value instead of covering.
Returns
The prediction array values.

Definition at line 584 of file pybind_wrapper.cpp.

References XCSF::cover, error(), Input::n_samples, XCSF::pa_size, set_cover(), XCSF::x_dim, xcs, and xcs_supervised_predict().

Here is the call graph for this function:

◆ print_params()

void XCS::print_params ( void  )
inline

Prints the XCSF parameters and their current values.

Definition at line 177 of file pybind_wrapper.cpp.

References param_print(), and xcs.

Here is the call graph for this function:

◆ print_pset()

void XCS::print_pset ( const bool  condition,
const bool  action,
const bool  prediction 
)
inline

Prints the current population.

Parameters
[in]conditionWhether to print the condition.
[in]actionWhether to print the action.
[in]predictionWhether to print the prediction.

Definition at line 210 of file pybind_wrapper.cpp.

References action, xcs, and xcsf_print_pset().

Here is the call graph for this function:

◆ print_status()

void XCS::print_status ( )
inline

Prints the current performance metrics.

Definition at line 381 of file pybind_wrapper.cpp.

References get_timestamp(), metric_mfrac, metric_msize, metric_psize, metric_train, metric_trial, metric_val, and val_data.

Referenced by fit().

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

◆ reset()

void XCS::reset ( void  )
inline

Resets basic constructor variables.

Definition at line 108 of file pybind_wrapper.cpp.

References action, metric_counter, Input::n_samples, param_init(), payoff, state, test_data, train_data, update_params(), val_data, Input::x, Input::x_dim, xcs, Input::y, and Input::y_dim.

Referenced by XCS().

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

◆ retrieve()

void XCS::retrieve ( void  )
inline

Retrieves the stored population, setting it as current.

Definition at line 168 of file pybind_wrapper.cpp.

References xcs, and xcsf_retrieve_pset().

Here is the call graph for this function:

◆ save()

size_t XCS::save ( const char *  filename)
inline

Writes the entire current state of XCSF to a file.

Parameters
[in]filenameString containing the name of the output file.
Returns
The total number of elements written.

Definition at line 137 of file pybind_wrapper.cpp.

References xcs, and xcsf_save().

Here is the call graph for this function:

◆ score()

double XCS::score ( const py::array_t< double >  X,
const py::array_t< double >  Y,
const int  N,
const py::object &  cover 
)
inline

Returns the error using N random samples from the provided data.

Parameters
[in]XThe input values to use for scoring.
[in]YThe true output values to use for scoring.
[in]NThe maximum number of samples to draw randomly for scoring.
[in]coverIf the match set is empty, the prediction array will be set to this value, otherwise it is set to zeros.
Returns
The average XCSF error using the loss function.

Definition at line 618 of file pybind_wrapper.cpp.

References XCSF::cover, load_input(), set_cover(), test_data, xcs, xcs_supervised_score(), and xcs_supervised_score_n().

Here is the call graph for this function:

◆ serialize()

py::bytes XCS::serialize ( ) const
inline

Implements pickle file writing.

Uses a temporary binary file.

Returns
The pickled XCSF.

Definition at line 635 of file pybind_wrapper.cpp.

References state, xcs, and xcsf_save().

Here is the call graph for this function:

◆ set_cover()

void XCS::set_cover ( const py::object &  cover)
inline

Sets the XCSF cover array to values given, or zeros.

Parameters
[in]coverThe values to use instead of covering.

Definition at line 566 of file pybind_wrapper.cpp.

References XCSF::cover, get_cover(), XCSF::pa_size, and xcs.

Referenced by predict(), and score().

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

◆ set_params()

XCS& XCS::set_params ( py::kwargs  kwargs)
inline

Sets parameter values.

Parameters
kwargsParameters and their values.
Returns
The XCSF object.

Definition at line 854 of file pybind_wrapper.cpp.

References param_json_import(), params, and xcs.

Referenced by XCS().

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

◆ store()

void XCS::store ( void  )
inline

Stores the current population in memory for later retrieval.

Definition at line 159 of file pybind_wrapper.cpp.

References xcs, and xcsf_store_pset().

Here is the call graph for this function:

◆ update()

void XCS::update ( const double  reward,
const bool  done 
)
inline

Creates the action set using the previously selected action, updates the classifiers, and runs the EA on explore steps.

Parameters
[in]rewardThe reward from performing the action.
[in]doneWhether the environment is in a terminal state.

Definition at line 308 of file pybind_wrapper.cpp.

References action, payoff, state, xcs, and xcs_rl_update().

Here is the call graph for this function:

◆ update_metrics()

void XCS::update_metrics ( const double  train,
const double  val,
const int  n_trials 
)
inline

Updates performance metrics.

Parameters
[in]trainThe current training error.
[in]valThe current validation error.
[in]n_trialsNumber of trials run.

Definition at line 409 of file pybind_wrapper.cpp.

References metric_counter, metric_mfrac, metric_msize, metric_psize, metric_train, metric_trial, metric_val, XCSF::mfrac, XCSF::mset_size, XCSF::pset, Set::size, and xcs.

Referenced by fit().

Here is the caller graph for this function:

◆ update_params()

void XCS::update_params ( )
inline

Updates the Python object's parameter dictionary.

Definition at line 819 of file pybind_wrapper.cpp.

References param_json_export(), params, and xcs.

Referenced by load(), and reset().

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

Field Documentation

◆ action

int XCS::action
private

Current action for RL.

Definition at line 69 of file pybind_wrapper.cpp.

Referenced by decision(), end_step(), error(), fit(), json_export(), print_pset(), reset(), and update().

◆ metric_counter

int XCS::metric_counter
private

Definition at line 81 of file pybind_wrapper.cpp.

Referenced by reset(), and update_metrics().

◆ metric_mfrac

py::list XCS::metric_mfrac
private

Definition at line 80 of file pybind_wrapper.cpp.

Referenced by get_metrics(), print_status(), and update_metrics().

◆ metric_msize

py::list XCS::metric_msize
private

Definition at line 79 of file pybind_wrapper.cpp.

Referenced by get_metrics(), print_status(), and update_metrics().

◆ metric_psize

py::list XCS::metric_psize
private

Definition at line 78 of file pybind_wrapper.cpp.

Referenced by get_metrics(), print_status(), and update_metrics().

◆ metric_train

py::list XCS::metric_train
private

Definition at line 75 of file pybind_wrapper.cpp.

Referenced by get_metrics(), print_status(), and update_metrics().

◆ metric_trial

py::list XCS::metric_trial
private

Definition at line 77 of file pybind_wrapper.cpp.

Referenced by get_metrics(), print_status(), and update_metrics().

◆ metric_val

py::list XCS::metric_val
private

Definition at line 76 of file pybind_wrapper.cpp.

Referenced by get_metrics(), print_status(), and update_metrics().

◆ params

py::dict XCS::params
private

Dictionary of parameters and their values.

Definition at line 74 of file pybind_wrapper.cpp.

Referenced by get_params(), set_params(), and update_params().

◆ payoff

double XCS::payoff
private

Current reward for RL.

Definition at line 70 of file pybind_wrapper.cpp.

Referenced by end_step(), error(), reset(), and update().

◆ state

double* XCS::state
private

Current input state for RL.

Definition at line 68 of file pybind_wrapper.cpp.

Referenced by decision(), deserialize(), end_step(), fit(), reset(), serialize(), and update().

◆ test_data

struct Input* XCS::test_data
private

Test data for supervised learning.

Definition at line 72 of file pybind_wrapper.cpp.

Referenced by load_validation_data(), reset(), and score().

◆ train_data

struct Input* XCS::train_data
private

Training data for supervised learning.

Definition at line 71 of file pybind_wrapper.cpp.

Referenced by fit(), and reset().

◆ val_data

struct Input* XCS::val_data
private

Validation data.

Definition at line 73 of file pybind_wrapper.cpp.

Referenced by fit(), load_validation_data(), print_status(), and reset().

◆ xcs


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