XCSF
1.4.7
XCSF learning classifier system
|
Interface for classifier predictions. More...
#include "pred_constant.h"
#include "pred_neural.h"
#include "pred_nlms.h"
#include "pred_rls.h"
#include "utils.h"
Go to the source code of this file.
Functions | |
void | prediction_set (const struct XCSF *xcsf, struct Cl *c) |
Sets a classifier's prediction functions to the implementations. More... | |
const char * | prediction_type_as_string (const int type) |
Returns a string representation of a prediction type from the integer. More... | |
int | prediction_type_as_int (const char *type) |
Returns the integer representation of a prediction type given a name. More... | |
void | pred_param_defaults (struct XCSF *xcsf) |
Initialises default prediction parameters. More... | |
char * | pred_param_json_export (const struct XCSF *xcsf) |
Returns a json formatted string of the prediction parameters. More... | |
char * | pred_param_json_import (struct XCSF *xcsf, cJSON *json) |
Sets the prediction parameters from a cJSON object. More... | |
size_t | pred_param_save (const struct XCSF *xcsf, FILE *fp) |
Saves prediction parameters. More... | |
size_t | pred_param_load (struct XCSF *xcsf, FILE *fp) |
Loads prediction parameters. More... | |
void | pred_param_free (struct XCSF *xcsf) |
Frees prediction parameters. More... | |
void | pred_transform_input (const struct XCSF *xcsf, const double *x, const double X0, double *tmp_input) |
Prepares the input state for least squares computation. More... | |
void | pred_param_set_eta (struct XCSF *xcsf, const double a) |
void | pred_param_set_eta_min (struct XCSF *xcsf, const double a) |
void | pred_param_set_lambda (struct XCSF *xcsf, const double a) |
void | pred_param_set_scale_factor (struct XCSF *xcsf, const double a) |
void | pred_param_set_x0 (struct XCSF *xcsf, const double a) |
void | pred_param_set_evolve_eta (struct XCSF *xcsf, const bool a) |
void | pred_param_set_type (struct XCSF *xcsf, const int a) |
int | pred_param_set_type_string (struct XCSF *xcsf, const char *a) |
Interface for classifier predictions.
Definition in file prediction.c.
void pred_param_defaults | ( | struct XCSF * | xcsf | ) |
Initialises default prediction parameters.
[in] | xcsf | The XCSF data structure. |
Definition at line 120 of file prediction.c.
References pred_neural_param_defaults(), pred_param_set_eta(), pred_param_set_eta_min(), pred_param_set_evolve_eta(), pred_param_set_lambda(), pred_param_set_scale_factor(), pred_param_set_type(), pred_param_set_x0(), and PRED_TYPE_NLMS_LINEAR.
Referenced by param_init().
void pred_param_free | ( | struct XCSF * | xcsf | ) |
Frees prediction parameters.
[in] | xcsf | The XCSF data structure. |
Definition at line 252 of file prediction.c.
References layer_args_free().
Referenced by param_free().
char* pred_param_json_export | ( | const struct XCSF * | xcsf | ) |
Returns a json formatted string of the prediction parameters.
[in] | xcsf | XCSF data structure. |
Definition at line 138 of file prediction.c.
References layer_args_json_export(), pred_nlms_param_json_export(), pred_rls_param_json_export(), PRED_TYPE_NEURAL, PRED_TYPE_NLMS_LINEAR, PRED_TYPE_NLMS_QUADRATIC, PRED_TYPE_RLS_LINEAR, PRED_TYPE_RLS_QUADRATIC, prediction_type_as_string(), and ArgsPred::type.
Referenced by param_json_export().
char* pred_param_json_import | ( | struct XCSF * | xcsf, |
cJSON * | json | ||
) |
Sets the prediction parameters from a cJSON object.
[in,out] | xcsf | XCSF data structure. |
[in] | json | cJSON object. |
Definition at line 179 of file prediction.c.
References pred_neural_param_json_import(), pred_nlms_param_json_import(), pred_rls_param_json_import(), PRED_TYPE_CONSTANT, PRED_TYPE_NEURAL, PRED_TYPE_NLMS_LINEAR, PRED_TYPE_NLMS_QUADRATIC, PRED_TYPE_RLS_LINEAR, and PRED_TYPE_RLS_QUADRATIC.
Referenced by param_json_import_prediction().
size_t pred_param_load | ( | struct XCSF * | xcsf, |
FILE * | fp | ||
) |
Loads prediction parameters.
[in] | xcsf | The XCSF data structure. |
[in] | fp | Pointer to the output file. |
Definition at line 232 of file prediction.c.
References ArgsPred::eta, ArgsPred::eta_min, ArgsPred::evolve_eta, ArgsPred::lambda, ArgsPred::largs, layer_args_load(), ArgsPred::scale_factor, ArgsPred::type, and ArgsPred::x0.
Referenced by param_load().
size_t pred_param_save | ( | const struct XCSF * | xcsf, |
FILE * | fp | ||
) |
Saves prediction parameters.
[in] | xcsf | The XCSF data structure. |
[in] | fp | Pointer to the output file. |
Definition at line 210 of file prediction.c.
References ArgsPred::eta, ArgsPred::eta_min, ArgsPred::evolve_eta, ArgsPred::lambda, ArgsPred::largs, layer_args_save(), ArgsPred::scale_factor, ArgsPred::type, and ArgsPred::x0.
Referenced by param_save().
void pred_param_set_eta | ( | struct XCSF * | xcsf, |
const double | a | ||
) |
Definition at line 291 of file prediction.c.
Referenced by pred_nlms_param_json_import(), and pred_param_defaults().
void pred_param_set_eta_min | ( | struct XCSF * | xcsf, |
const double | a | ||
) |
Definition at line 305 of file prediction.c.
Referenced by pred_nlms_param_json_import(), and pred_param_defaults().
void pred_param_set_evolve_eta | ( | struct XCSF * | xcsf, |
const bool | a | ||
) |
Definition at line 337 of file prediction.c.
Referenced by pred_nlms_param_json_import(), and pred_param_defaults().
void pred_param_set_lambda | ( | struct XCSF * | xcsf, |
const double | a | ||
) |
Definition at line 319 of file prediction.c.
Referenced by pred_param_defaults(), and pred_rls_param_json_import().
void pred_param_set_scale_factor | ( | struct XCSF * | xcsf, |
const double | a | ||
) |
Definition at line 325 of file prediction.c.
Referenced by pred_param_defaults(), and pred_rls_param_json_import().
void pred_param_set_type | ( | struct XCSF * | xcsf, |
const int | a | ||
) |
Definition at line 343 of file prediction.c.
Referenced by pred_param_defaults().
int pred_param_set_type_string | ( | struct XCSF * | xcsf, |
const char * | a | ||
) |
Definition at line 354 of file prediction.c.
References PRED_TYPE_INVALID, prediction_type_as_int(), and ArgsPred::type.
Referenced by param_json_import_prediction().
void pred_param_set_x0 | ( | struct XCSF * | xcsf, |
const double | a | ||
) |
Definition at line 331 of file prediction.c.
Referenced by pred_nlms_param_json_import(), pred_param_defaults(), and pred_rls_param_json_import().
void pred_transform_input | ( | const struct XCSF * | xcsf, |
const double * | x, | ||
const double | X0, | ||
double * | tmp_input | ||
) |
Prepares the input state for least squares computation.
[in] | xcsf | The XCSF data structure. |
[in] | x | The input state. |
[in] | X0 | Bias term. |
[out] | tmp_input | The transformed input. |
Definition at line 265 of file prediction.c.
References PRED_TYPE_NLMS_QUADRATIC, and PRED_TYPE_RLS_QUADRATIC.
Referenced by pred_nlms_compute(), and pred_rls_compute().
Sets a classifier's prediction functions to the implementations.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier to set. |
Definition at line 36 of file prediction.c.
References pred_constant_vtbl, pred_neural_vtbl, pred_nlms_vtbl, pred_rls_vtbl, PRED_TYPE_CONSTANT, PRED_TYPE_NEURAL, PRED_TYPE_NLMS_LINEAR, PRED_TYPE_NLMS_QUADRATIC, PRED_TYPE_RLS_LINEAR, PRED_TYPE_RLS_QUADRATIC, and Cl::pred_vptr.
Referenced by cl_load(), and cl_rand().
int prediction_type_as_int | ( | const char * | type | ) |
Returns the integer representation of a prediction type given a name.
[in] | type | String representation of a prediction type. |
Definition at line 92 of file prediction.c.
References PRED_STRING_CONSTANT, PRED_STRING_NEURAL, PRED_STRING_NLMS_LINEAR, PRED_STRING_NLMS_QUADRATIC, PRED_STRING_RLS_LINEAR, PRED_STRING_RLS_QUADRATIC, PRED_TYPE_CONSTANT, PRED_TYPE_INVALID, PRED_TYPE_NEURAL, PRED_TYPE_NLMS_LINEAR, PRED_TYPE_NLMS_QUADRATIC, PRED_TYPE_RLS_LINEAR, and PRED_TYPE_RLS_QUADRATIC.
Referenced by pred_json_import(), and pred_param_set_type_string().
const char* prediction_type_as_string | ( | const int | type | ) |
Returns a string representation of a prediction type from the integer.
[in] | type | Integer representation of a prediction type. |
Definition at line 65 of file prediction.c.
References PRED_STRING_CONSTANT, PRED_STRING_NEURAL, PRED_STRING_NLMS_LINEAR, PRED_STRING_NLMS_QUADRATIC, PRED_STRING_RLS_LINEAR, PRED_STRING_RLS_QUADRATIC, PRED_TYPE_CONSTANT, PRED_TYPE_NEURAL, PRED_TYPE_NLMS_LINEAR, PRED_TYPE_NLMS_QUADRATIC, PRED_TYPE_RLS_LINEAR, and PRED_TYPE_RLS_QUADRATIC.
Referenced by pred_json_import(), and pred_param_json_export().