37 switch (
xcsf->act->type) {
45 printf(
"Invalid action type specified: %d\n",
xcsf->act->type);
64 printf(
"action_type_as_string(): invalid type: %d\n", type);
106 cJSON *json = cJSON_CreateObject();
108 char *json_str = NULL;
112 if (json_str != NULL) {
113 cJSON *params = cJSON_Parse(json_str);
114 if (params != NULL) {
115 cJSON_AddItemToObject(json,
"args", params);
119 char *
string = cJSON_Print(json);
134 switch (
xcsf->act->type) {
141 printf(
"action_param_json_import(): unknown type.\n");
158 s += fwrite(&act->
type,
sizeof(
int), 1, fp);
174 s += fread(&act->
type,
sizeof(
int), 1, fp);
205 printf(
"Warning: tried to set ACT TYPE too small\n");
integer action functions.
static struct ActVtbl const act_integer_vtbl
Integer action implemented functions.
void act_neural_param_defaults(struct XCSF *xcsf)
Initialises default neural action parameters.
char * act_neural_param_json_import(struct XCSF *xcsf, cJSON *json)
Sets the neural network parameters from a cJSON object.
Neural network action functions.
static struct ActVtbl const act_neural_vtbl
neural action implemented functions.
size_t action_param_load(struct XCSF *xcsf, FILE *fp)
Loads action parameters.
void action_param_set_type(struct XCSF *xcsf, const int a)
int action_type_as_int(const char *type)
Returns the integer representation of an action type given a name.
char * action_param_json_import(struct XCSF *xcsf, cJSON *json)
Sets the action parameters from a cJSON object.
void action_set(const struct XCSF *xcsf, struct Cl *c)
Sets a classifier's action functions to the implementations.
const char * action_type_as_string(const int type)
Returns a string representation of an action type from an integer.
size_t action_param_save(const struct XCSF *xcsf, FILE *fp)
Saves action parameters.
int action_param_set_type_string(struct XCSF *xcsf, const char *a)
void action_param_defaults(struct XCSF *xcsf)
Initialises default action parameters.
void action_param_free(struct XCSF *xcsf)
Frees action parameters.
char * action_param_json_export(const struct XCSF *xcsf)
Returns a json formatted string of the action parameters.
Interface for classifier actions.
#define ACT_TYPE_NEURAL
Action type neural network.
#define ACT_TYPE_INVALID
Error code for invalid actions.
#define ACT_STRING_INTEGER
Integer.
#define ACT_STRING_NEURAL
Neural.
#define ACT_TYPE_INTEGER
Action type integer.
char * layer_args_json_export(struct ArgsLayer *args)
Returns a json formatted string of the neural layer parameters.
size_t layer_args_load(struct ArgsLayer **largs, FILE *fp)
Loads neural network layer parameters.
void layer_args_free(struct ArgsLayer **largs)
Frees memory used by a list of layer parameters and points to NULL.
size_t layer_args_save(const struct ArgsLayer *args, FILE *fp)
Saves neural network layer parameters.
Parameters for initialising and operating actions.
struct ArgsLayer * largs
Linked-list of layer parameters.
int type
Classifier action type.
Classifier data structure.
struct ActVtbl const * act_vptr
Functions acting on actions.
Utility functions for random number handling, etc.