67 if (
xcsf->mset.size < 1) {
69 memcpy(
xcsf->pa, cover,
sizeof(
double) *
xcsf->pa_size);
100 const struct Input *test_data,
const bool shuffle,
101 const int start,
const int trials)
106 for (
int cnt = 0; cnt < trials; ++cnt) {
109 const double *x = &train_data->
x[row * train_data->
x_dim];
110 const double *y = &train_data->
y[row * train_data->
y_dim];
113 const double error = (
xcsf->loss_ptr)(
xcsf,
xcsf->pa, y);
118 if (test_data != NULL) {
120 x = &test_data->
x[row * test_data->
x_dim];
121 y = &test_data->
y[row * test_data->
y_dim];
142 const int n_samples,
const double *cover)
145 for (
int row = 0; row < n_samples; ++row) {
147 memcpy(&pred[row *
xcsf->pa_size],
xcsf->pa,
148 sizeof(
double) *
xcsf->pa_size);
166 for (
int row = 0; row < data->
n_samples; ++row) {
167 const double *x = &data->
x[row * data->
x_dim];
168 const double *y = &data->
y[row * data->
y_dim];
193 for (
int i = 0; i < N; ++i) {
195 const double *x = &data->
x[row * data->
x_dim];
196 const double *y = &data->
y[row * data->
y_dim];
void clset_kill(const struct XCSF *xcsf, struct Set *set)
Frees the set and the classifiers.
void clset_update(struct XCSF *xcsf, struct Set *set, const double *x, const double *y, const bool cur)
Provides reinforcement to the set and performs set subsumption.
void clset_init(struct Set *set)
Initialises a new set.
void clset_match(struct XCSF *xcsf, const double *x, const bool cover)
Constructs the match set - forward propagates conditions and actions.
void clset_free(struct Set *set)
Frees the set, but not the classifiers.
Functions operating on sets of classifiers.
void ea(struct XCSF *xcsf, const struct Set *set)
Executes the evolutionary algorithm (EA).
Evolutionary algorithm functions.
Loss functions for calculating prediction error.
void pa_build(const struct XCSF *xcsf, const double *x)
Builds the prediction array for the specified input.
Prediction array functions.
const char * param_set_explore(struct XCSF *xcsf, const bool a)
Functions for setting and printing parameters.
void perf_print(const struct XCSF *xcsf, double *error, double *terror, const int trial)
Displays the current training and test performance.
System performance printing.
int rand_uniform_int(const int min, const int max)
Returns a uniform random integer [min,max] not inclusive of max.
Utility functions for random number handling, etc.
double xcs_supervised_fit(struct XCSF *xcsf, const struct Input *train_data, const struct Input *test_data, const bool shuffle, const int start, const int trials)
Executes MAX_TRIALS number of XCSF learning iterations using the training data and test iterations us...
double xcs_supervised_score(struct XCSF *xcsf, const struct Input *data, const double *cover)
Calculates the XCSF error for the input data.
static void xcs_supervised_trial(struct XCSF *xcsf, const double *x, const double *y, const double *cover)
Executes a single XCSF trial.
double xcs_supervised_score_n(struct XCSF *xcsf, const struct Input *data, const int N, const double *cover)
Calculates the XCSF error for a subsample of the input data.
static int xcs_supervised_sample(const struct Input *data, const int cnt, const bool shuffle)
Selects a data sample for training or testing.
void xcs_supervised_predict(struct XCSF *xcsf, const double *x, double *pred, const int n_samples, const double *cover)
Calculates the XCSF predictions for the provided input.
Supervised regression learning functions.