XCSF
1.4.7
XCSF learning classifier system
|
Normalised least mean squares prediction functions. More...
Go to the source code of this file.
Data Structures | |
struct | PredNLMS |
Normalised least mean squares prediction data structure. More... | |
Functions | |
char * | pred_nlms_param_json_import (struct XCSF *xcsf, cJSON *json) |
Sets the NLMS parameters from a cJSON object. More... | |
char * | pred_nlms_param_json_export (const struct XCSF *xcsf) |
Returns a json formatted string of the NLMS parameters. More... | |
bool | pred_nlms_crossover (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
Dummy function since NLMS predictions do not perform crossover. More... | |
bool | pred_nlms_mutate (const struct XCSF *xcsf, const struct Cl *c) |
Mutates the gradient descent rate used to update an NLMS prediction. More... | |
double | pred_nlms_size (const struct XCSF *xcsf, const struct Cl *c) |
Returns the size of an NLMS prediction. More... | |
size_t | pred_nlms_load (const struct XCSF *xcsf, struct Cl *c, FILE *fp) |
Reads an NLMS prediction from a file. More... | |
size_t | pred_nlms_save (const struct XCSF *xcsf, const struct Cl *c, FILE *fp) |
Writes an NLMS prediction to a file. More... | |
void | pred_nlms_compute (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
Computes the current NLMS prediction for a provided input. More... | |
void | pred_nlms_copy (const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src) |
Copies an NLMS prediction from one classifier to another. More... | |
void | pred_nlms_free (const struct XCSF *xcsf, const struct Cl *c) |
Frees the memory used by an NLMS prediction. More... | |
void | pred_nlms_init (const struct XCSF *xcsf, struct Cl *c) |
Initialises an NLMS prediction. More... | |
void | pred_nlms_print (const struct XCSF *xcsf, const struct Cl *c) |
Prints an NLMS prediction. More... | |
void | pred_nlms_update (const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y) |
Updates an NLMS prediction for a given input and truth sample. More... | |
char * | pred_nlms_json_export (const struct XCSF *xcsf, const struct Cl *c) |
Returns a json formatted string representation of an NLMS prediction. More... | |
void | pred_nlms_json_import (const struct XCSF *xcsf, struct Cl *c, const cJSON *json) |
Creates an NLMS prediction from a cJSON object. More... | |
Variables | |
static struct PredVtbl const | pred_nlms_vtbl |
Normalised least mean squares prediction implemented functions. More... | |
Normalised least mean squares prediction functions.
Definition in file pred_nlms.h.
Computes the current NLMS prediction for a provided input.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier calculating the prediction. |
[in] | x | The input state. |
Definition at line 138 of file pred_nlms.c.
References blas_dot(), PredNLMS::n, Cl::pred, pred_transform_input(), Cl::prediction, PredNLMS::tmp_input, and PredNLMS::weights.
Copies an NLMS prediction from one classifier to another.
[in] | xcsf | The XCSF data structure. |
[in] | dest | The destination classifier. |
[in] | src | The source classifier. |
Definition at line 79 of file pred_nlms.c.
References PredNLMS::eta, PredNLMS::mu, N_MU, PredNLMS::n_weights, Cl::pred, pred_nlms_init(), and PredNLMS::weights.
Dummy function since NLMS predictions do not perform crossover.
[in] | xcsf | The XCSF data structure. |
[in] | c1 | The first classifier whose prediction is being crossed. |
[in] | c2 | The second classifier whose prediction is being crossed. |
Definition at line 170 of file pred_nlms.c.
Frees the memory used by an NLMS prediction.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction is to be freed. |
Definition at line 96 of file pred_nlms.c.
References PredNLMS::mu, Cl::pred, PredNLMS::tmp_input, and PredNLMS::weights.
Initialises an NLMS prediction.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction is to be initialised. |
Definition at line 44 of file pred_nlms.c.
References blas_fill(), PredNLMS::eta, PredNLMS::mu, MU_TYPE, PredNLMS::n, N_MU, PredNLMS::n_weights, Cl::pred, PRED_TYPE_NLMS_QUADRATIC, rand_uniform(), sam_init(), PredNLMS::tmp_input, and PredNLMS::weights.
Referenced by pred_nlms_copy(), and pred_nlms_load().
Returns a json formatted string representation of an NLMS prediction.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose prediction is to be returned. |
Definition at line 264 of file pred_nlms.c.
References PredNLMS::eta, PredNLMS::mu, N_MU, PredNLMS::n_weights, Cl::pred, PRED_TYPE_NLMS_QUADRATIC, and PredNLMS::weights.
Referenced by pred_nlms_print().
Creates an NLMS prediction from a cJSON object.
[in] | xcsf | The XCSF data structure. |
[in,out] | c | The classifier to initialise. |
[in] | json | cJSON object. |
Definition at line 290 of file pred_nlms.c.
References PredNLMS::eta, PredNLMS::mu, N_MU, PredNLMS::n_weights, Cl::pred, sam_json_import(), and PredNLMS::weights.
Reads an NLMS prediction from a file.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction is to be read. |
[in] | fp | Pointer to the file to be read. |
Definition at line 244 of file pred_nlms.c.
References PredNLMS::eta, PredNLMS::mu, PredNLMS::n, N_MU, PredNLMS::n_weights, Cl::pred, pred_nlms_init(), and PredNLMS::weights.
Mutates the gradient descent rate used to update an NLMS prediction.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction is being mutated. |
Definition at line 186 of file pred_nlms.c.
References clamp(), PredNLMS::eta, PredNLMS::mu, MU_TYPE, N_MU, Cl::pred, rand_normal(), and sam_adapt().
char* pred_nlms_param_json_export | ( | const struct XCSF * | xcsf | ) |
Returns a json formatted string of the NLMS parameters.
[in] | xcsf | The XCSF data structure. |
Definition at line 319 of file pred_nlms.c.
References ArgsPred::eta, ArgsPred::eta_min, ArgsPred::evolve_eta, and ArgsPred::x0.
Referenced by pred_param_json_export().
char* pred_nlms_param_json_import | ( | struct XCSF * | xcsf, |
cJSON * | json | ||
) |
Sets the NLMS parameters from a cJSON object.
[in,out] | xcsf | The XCSF data structure. |
[in] | json | cJSON object. |
Definition at line 341 of file pred_nlms.c.
References pred_param_set_eta(), pred_param_set_eta_min(), pred_param_set_evolve_eta(), and pred_param_set_x0().
Referenced by pred_param_json_import().
Prints an NLMS prediction.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction is to be printed. |
Definition at line 155 of file pred_nlms.c.
References pred_nlms_json_export().
Writes an NLMS prediction to a file.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction is to be written. |
[in] | fp | Pointer to the file to be written. |
Definition at line 223 of file pred_nlms.c.
References PredNLMS::eta, PredNLMS::mu, PredNLMS::n, N_MU, PredNLMS::n_weights, Cl::pred, and PredNLMS::weights.
Returns the size of an NLMS prediction.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction size to return. |
Definition at line 208 of file pred_nlms.c.
References PredNLMS::n_weights, and Cl::pred.
void pred_nlms_update | ( | const struct XCSF * | xcsf, |
const struct Cl * | c, | ||
const double * | x, | ||
const double * | y | ||
) |
Updates an NLMS prediction for a given input and truth sample.
[in] | xcsf | The XCSF data structure. |
[in] | c | Classifier whose prediction is to be updated. |
[in] | x | Input state. |
[in] | y | Truth/payoff value. |
Definition at line 115 of file pred_nlms.c.
References blas_axpy(), blas_dot(), PredNLMS::eta, PredNLMS::n, Cl::pred, Cl::prediction, PredNLMS::tmp_input, and PredNLMS::weights.
|
static |
Normalised least mean squares prediction implemented functions.
Definition at line 86 of file pred_nlms.h.
Referenced by prediction_set().