|
XCSF 1.4.8
XCSF learning classifier system
|
#include "utils.h"#include <errno.h>#include <float.h>#include <inttypes.h>#include <limits.h>#include <math.h>#include <stdbool.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <string.h>Go to the source code of this file.
Data Structures | |
| struct | Cl |
| Classifier data structure. More... | |
| struct | Clist |
| Classifier linked list. More... | |
| struct | Set |
| Classifier set. More... | |
| struct | XCSF |
| XCSF data structure. More... | |
| struct | Input |
| Input data structure. More... | |
Functions | |
| size_t | xcsf_load (struct XCSF *xcsf, const char *filename) |
| Reads the state of XCSF from a file. | |
| size_t | xcsf_save (const struct XCSF *xcsf, const char *filename) |
| Writes the current state of XCSF to a file. | |
| void | xcsf_free (struct XCSF *xcsf) |
| Frees XCSF population sets. | |
| void | xcsf_init (struct XCSF *xcsf) |
| Initialises XCSF with an empty population. | |
| 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_ae_to_classifier (struct XCSF *xcsf, const int y_dim, const int n_del) |
| Switches from autoencoding to classification. | |
| void | xcsf_pred_expand (const struct XCSF *xcsf) |
| Inserts a new hidden layer before the output layer within all prediction neural networks in the population. | |
| void | xcsf_retrieve_pset (struct XCSF *xcsf) |
| Retrieves the previously stored population. | |
| void | xcsf_store_pset (struct XCSF *xcsf) |
| Stores the current population. | |
Variables | |
| static const int | VERSION_MAJOR = 1 |
| XCSF major version number. | |
| static const int | VERSION_MINOR = 4 |
| XCSF minor version number. | |
| static const int | VERSION_BUILD = 8 |
| XCSF build version number. | |
| void xcsf_ae_to_classifier | ( | struct XCSF * | xcsf, |
| const int | y_dim, | ||
| const int | n_del | ||
| ) |
Switches from autoencoding to classification.
| [in] | xcsf | The XCSF data structure. |
| [in] | y_dim | The output dimension (i.e., the number of classes). |
| [in] | n_del | The number of hidden layers to remove. |
Definition at line 171 of file xcsf.c.
References Clist::cl, Cl::err, Cl::exp, Cl::fit, LOSS_ONEHOT, Clist::next, pa_free(), pa_init(), param_set_loss_func(), param_set_y_dim(), pred_neural_ae_to_classifier(), Cl::prediction, and Cl::time.
Referenced by XCS::ae_to_classifier().
| void xcsf_free | ( | struct XCSF * | xcsf | ) |
Frees XCSF population sets.
| [in] | xcsf | The XCSF data structure. |
Definition at line 56 of file xcsf.c.
References clset_kill(), and pa_free().
Referenced by XCS::fit(), and main().
| void xcsf_init | ( | struct XCSF * | xcsf | ) |
Initialises XCSF with an empty population.
| [in] | xcsf | The XCSF data structure. |
Definition at line 37 of file xcsf.c.
References clset_init(), clset_pset_init(), and pa_init().
Referenced by XCS::fit(), main(), XCS::XCS(), and XCS::XCS().
| size_t xcsf_load | ( | struct XCSF * | xcsf, |
| const char * | filename | ||
| ) |
Reads the state of XCSF from a file.
| [in] | xcsf | The XCSF data structure. |
| [in] | filename | The name of the input file. |
Definition at line 114 of file xcsf.c.
References clset_init(), clset_kill(), clset_pset_load(), param_load(), VERSION_MAJOR, and VERSION_MINOR.
Referenced by XCS::deserialize(), XCS::load(), and main().
| void xcsf_pred_expand | ( | const struct XCSF * | xcsf | ) |
Inserts a new hidden layer before the output layer within all prediction neural networks in the population.
| [in] | xcsf | The XCSF data structure. |
Definition at line 151 of file xcsf.c.
References Clist::cl, Cl::err, Cl::exp, Cl::fit, Clist::next, pred_neural_expand(), and Cl::time.
Referenced by XCS::pred_expand().
| 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.
| [in] | xcsf | The XCSF data structure. |
| [in] | print_cond | Whether to print condition structures. |
| [in] | print_act | Whether to print action structures. |
| [in] | print_pred | Whether to print prediction structures. |
Definition at line 77 of file xcsf.c.
References clset_print().
Referenced by XCS::print_pset().
| void xcsf_retrieve_pset | ( | struct XCSF * | xcsf | ) |
Retrieves the previously stored population.
| [in] | xcsf | The XCSF data structure. |
Definition at line 213 of file xcsf.c.
References clset_init(), and clset_kill().
Referenced by EarlyStoppingCallback::retrieve(), and XCS::retrieve().
| size_t xcsf_save | ( | const struct XCSF * | xcsf, |
| const char * | filename | ||
| ) |
Writes the current state of XCSF to a file.
| [in] | xcsf | The XCSF data structure. |
| [in] | filename | The name of the output file. |
Definition at line 90 of file xcsf.c.
References clset_pset_save(), param_save(), VERSION_BUILD, VERSION_MAJOR, and VERSION_MINOR.
Referenced by XCS::save(), CheckpointCallback::save(), and XCS::serialize().
| void xcsf_store_pset | ( | struct XCSF * | xcsf | ) |
Stores the current population.
| [in] | xcsf | The XCSF data structure. |
Definition at line 195 of file xcsf.c.
References Clist::cl, cl_init_copy(), clset_add(), clset_kill(), and Clist::next.
Referenced by EarlyStoppingCallback::store(), and XCS::store().
|
static |
XCSF build version number.
Definition at line 40 of file xcsf.h.
Referenced by param_json_export(), and xcsf_save().
|
static |
XCSF major version number.
Definition at line 38 of file xcsf.h.
Referenced by param_json_export(), xcsf_load(), and xcsf_save().
|
static |
XCSF minor version number.
Definition at line 39 of file xcsf.h.
Referenced by param_json_export(), xcsf_load(), and xcsf_save().