44 xcsf->explore =
false;
63 xcsf->explore =
false;
78 const bool print_act,
const bool print_pred)
92 FILE *fp = fopen(filename,
"wb");
94 printf(
"Error saving file: %s. %s.\n", filename, strerror(errno));
116 if (
xcsf->pset.size > 0) {
120 FILE *fp = fopen(filename,
"rb");
122 printf(
"Error loading file: %s. %s.\n", filename, strerror(errno));
129 s += fread(&major,
sizeof(
int), 1, fp);
130 s += fread(&minor,
sizeof(
int), 1, fp);
131 s += fread(&build,
sizeof(
int), 1, fp);
133 printf(
"Error loading file: %s. Version mismatch. ", filename);
135 printf(
"Loaded version: %d.%d\n", major, minor);
153 const struct Clist *iter =
xcsf->pset.list;
154 while (iter != NULL) {
177 const struct Clist *iter =
xcsf->pset.list;
178 while (iter != NULL) {
198 const struct Clist *iter =
xcsf->pset.list;
199 while (iter != NULL) {
200 struct Cl *
new = malloc(
sizeof(
struct Cl));
201 const struct Cl *src = iter->
cl;
215 if (
xcsf->prev_pset.size < 1) {
216 printf(
"warning: xcsf_retrieve_pset() no previous population found\n");
void cl_init_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Initialises and creates a copy of one classifier from another.
Functions operating on classifiers.
void clset_pset_init(struct XCSF *xcsf)
Initialises a new population of random classifiers.
void clset_kill(const struct XCSF *xcsf, struct Set *set)
Frees the set and the classifiers.
void clset_add(struct Set *set, struct Cl *c)
Adds a classifier to the set.
void clset_print(const struct XCSF *xcsf, const struct Set *set, const bool print_cond, const bool print_act, const bool print_pred)
Prints the classifiers in the set.
size_t clset_pset_save(const struct XCSF *xcsf, FILE *fp)
Writes the population set to a file.
void clset_init(struct Set *set)
Initialises a new set.
size_t clset_pset_load(struct XCSF *xcsf, FILE *fp)
Reads the population set from a file.
Functions operating on sets of classifiers.
Multi-layer perceptron neural network condition functions.
Loss functions for calculating prediction error.
#define LOSS_ONEHOT
One-hot encoding classification error.
void pa_free(const struct XCSF *xcsf)
Frees the prediction array.
void pa_init(struct XCSF *xcsf)
Initialises the prediction array.
Prediction array functions.
const char * param_set_y_dim(struct XCSF *xcsf, const int a)
void param_set_loss_func(struct XCSF *xcsf, const int a)
size_t param_load(struct XCSF *xcsf, FILE *fp)
Reads the XCSF data structure from a file.
size_t param_save(const struct XCSF *xcsf, FILE *fp)
Writes the XCSF data structure to a file.
Functions for setting and printing parameters.
void pred_neural_ae_to_classifier(const struct XCSF *xcsf, const struct Cl *c, const int n_del)
Removes prediction (decoder) layers and inserts softmax output layer.
void pred_neural_expand(const struct XCSF *xcsf, const struct Cl *c)
Creates and inserts a hidden layer before the prediction output layer.
Multi-layer perceptron neural network prediction functions.
Classifier data structure.
int time
Time EA last executed in a participating set.
double * prediction
Current classifier prediction.
struct Clist * next
Pointer to the next list element.
struct Cl * cl
Pointer to classifier data structure.
void xcsf_store_pset(struct XCSF *xcsf)
Stores the current population.
size_t xcsf_save(const struct XCSF *xcsf, const char *filename)
Writes the current state of XCSF to a file.
void xcsf_retrieve_pset(struct XCSF *xcsf)
Retrieves the previously stored population.
void xcsf_pred_expand(const struct XCSF *xcsf)
Inserts a new hidden layer before the output layer within all prediction neural networks in the popul...
void xcsf_ae_to_classifier(struct XCSF *xcsf, const int y_dim, const int n_del)
Switches from autoencoding to classification.
size_t xcsf_load(struct XCSF *xcsf, const char *filename)
Reads the state of XCSF from a file.
void xcsf_print_pset(const struct XCSF *xcsf, const bool print_cond, const bool print_act, const bool print_pred)
Prints the current XCSF population.
void xcsf_init(struct XCSF *xcsf)
Initialises XCSF with an empty population.
void xcsf_free(struct XCSF *xcsf)
Frees XCSF population sets.
static const int VERSION_MINOR
XCSF minor version number.
static const int VERSION_MAJOR
XCSF major version number.
static const int VERSION_BUILD
XCSF build version number.