XCSF
1.4.7
XCSF learning classifier system
|
Recursive least mean squares prediction functions. More...
Go to the source code of this file.
Functions | |
void | pred_rls_init (const struct XCSF *xcsf, struct Cl *c) |
Initialises an RLS prediction. More... | |
void | pred_rls_copy (const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src) |
Copies an RLS prediction from one classifier to another. More... | |
void | pred_rls_free (const struct XCSF *xcsf, const struct Cl *c) |
Frees the memory used by an RLS prediction. More... | |
void | pred_rls_update (const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y) |
Updates an RLS prediction for a given input and truth sample. More... | |
void | pred_rls_compute (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
Computes the current RLS prediction for a provided input. More... | |
void | pred_rls_print (const struct XCSF *xcsf, const struct Cl *c) |
Prints an RLS prediction. More... | |
bool | pred_rls_crossover (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
Dummy function since RLS predictions do not perform crossover. More... | |
bool | pred_rls_mutate (const struct XCSF *xcsf, const struct Cl *c) |
Dummy function since RLS predictions do not perform mutation. More... | |
double | pred_rls_size (const struct XCSF *xcsf, const struct Cl *c) |
Returns the size of an RLS prediction. More... | |
size_t | pred_rls_save (const struct XCSF *xcsf, const struct Cl *c, FILE *fp) |
Writes an RLS prediction to a file. More... | |
size_t | pred_rls_load (const struct XCSF *xcsf, struct Cl *c, FILE *fp) |
Reads an RLS prediction from a file. More... | |
char * | pred_rls_json_export (const struct XCSF *xcsf, const struct Cl *c) |
Returns a json formatted string representation of an RLS prediction. More... | |
void | pred_rls_json_import (const struct XCSF *xcsf, struct Cl *c, const cJSON *json) |
Creates an RLS prediction from a cJSON object. More... | |
char * | pred_rls_param_json_export (const struct XCSF *xcsf) |
Returns a json formatted string of the RLS parameters. More... | |
char * | pred_rls_param_json_import (struct XCSF *xcsf, cJSON *json) |
Sets the RLS parameters from a cJSON object. More... | |
Recursive least mean squares prediction functions.
Definition in file pred_rls.c.
Computes the current RLS 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 158 of file pred_rls.c.
References blas_dot(), PredRLS::n, Cl::pred, pred_transform_input(), Cl::prediction, PredRLS::tmp_input, and PredRLS::weights.
Copies an RLS 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 69 of file pred_rls.c.
References PredRLS::n_weights, Cl::pred, pred_rls_init(), and PredRLS::weights.
Dummy function since RLS 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 190 of file pred_rls.c.
Frees the memory used by an RLS prediction.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction is to be freed. |
Definition at line 84 of file pred_rls.c.
References PredRLS::matrix, Cl::pred, PredRLS::tmp_input, PredRLS::tmp_matrix1, PredRLS::tmp_matrix2, PredRLS::tmp_vec, and PredRLS::weights.
Initialises an RLS prediction.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction is to be initialised. |
Definition at line 34 of file pred_rls.c.
References blas_fill(), PredRLS::matrix, PredRLS::n, PredRLS::n_weights, Cl::pred, PRED_TYPE_RLS_QUADRATIC, PredRLS::tmp_input, PredRLS::tmp_matrix1, PredRLS::tmp_matrix2, PredRLS::tmp_vec, and PredRLS::weights.
Referenced by pred_rls_copy(), and pred_rls_load().
Returns a json formatted string representation of an RLS prediction.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose prediction is to be returned. |
Definition at line 276 of file pred_rls.c.
References PredRLS::n_weights, Cl::pred, PRED_TYPE_RLS_QUADRATIC, and PredRLS::weights.
Referenced by pred_rls_print().
Creates an RLS 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 299 of file pred_rls.c.
References PredRLS::n_weights, Cl::pred, and PredRLS::weights.
Reads an RLS 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 256 of file pred_rls.c.
References PredRLS::matrix, PredRLS::n, PredRLS::n_weights, Cl::pred, pred_rls_init(), and PredRLS::weights.
Dummy function since RLS predictions do not perform mutation.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction is being mutated. |
Definition at line 206 of file pred_rls.c.
char* pred_rls_param_json_export | ( | const struct XCSF * | xcsf | ) |
Returns a json formatted string of the RLS parameters.
[in] | xcsf | The XCSF data structure. |
Definition at line 323 of file pred_rls.c.
References ArgsPred::lambda, ArgsPred::scale_factor, and ArgsPred::x0.
Referenced by pred_param_json_export().
char* pred_rls_param_json_import | ( | struct XCSF * | xcsf, |
cJSON * | json | ||
) |
Sets the RLS parameters from a cJSON object.
[in,out] | xcsf | The XCSF data structure. |
[in] | json | cJSON object. |
Definition at line 342 of file pred_rls.c.
References pred_param_set_lambda(), pred_param_set_scale_factor(), and pred_param_set_x0().
Referenced by pred_param_json_import().
Prints an RLS prediction.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction is to be printed. |
Definition at line 175 of file pred_rls.c.
References pred_rls_json_export().
Writes an RLS 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 235 of file pred_rls.c.
References PredRLS::matrix, PredRLS::n, PredRLS::n_weights, Cl::pred, and PredRLS::weights.
Returns the size of an RLS prediction.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose prediction size to return. |
Definition at line 220 of file pred_rls.c.
References PredRLS::n_weights, and Cl::pred.
void pred_rls_update | ( | const struct XCSF * | xcsf, |
const struct Cl * | c, | ||
const double * | x, | ||
const double * | y | ||
) |
Updates an RLS 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 106 of file pred_rls.c.
References blas_axpy(), blas_dot(), blas_gemm(), blas_scal(), PredRLS::matrix, PredRLS::n, Cl::pred, Cl::prediction, PredRLS::tmp_input, PredRLS::tmp_matrix1, PredRLS::tmp_matrix2, PredRLS::tmp_vec, and PredRLS::weights.