|
XCSF 1.4.8
XCSF learning classifier system
|
Neural network action functions. More...
#include "act_neural.h"#include "neural_activations.h"#include "neural_layer_avgpool.h"#include "neural_layer_connected.h"#include "neural_layer_convolutional.h"#include "neural_layer_dropout.h"#include "neural_layer_lstm.h"#include "neural_layer_maxpool.h"#include "neural_layer_noise.h"#include "neural_layer_recurrent.h"#include "neural_layer_softmax.h"#include "neural_layer_upsample.h"#include "utils.h"Go to the source code of this file.
Functions | |
| void | act_neural_init (const struct XCSF *xcsf, struct Cl *c) |
| Creates and initialises an action neural network. | |
| bool | act_neural_crossover (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
| Dummy function since crossover is not performed on neural actions. | |
| bool | act_neural_general (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
| Dummy function since neural actions do not generalise another. | |
| bool | act_neural_mutate (const struct XCSF *xcsf, const struct Cl *c) |
| Mutates a neural network action. | |
| int | act_neural_compute (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
| Computes the current neural network action using the input. | |
| void | act_neural_copy (const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src) |
| Copies a neural network action from one classifier to another. | |
| void | act_neural_print (const struct XCSF *xcsf, const struct Cl *c) |
| Prints a neural network action. | |
| void | act_neural_cover (const struct XCSF *xcsf, const struct Cl *c, const double *x, const int action) |
| Generates a neural network that covers the specified input:action. | |
| void | act_neural_free (const struct XCSF *xcsf, const struct Cl *c) |
| Frees the memory used by a neural network action. | |
| void | act_neural_update (const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y) |
| Dummy function since neural network actions are not updated. | |
| size_t | act_neural_save (const struct XCSF *xcsf, const struct Cl *c, FILE *fp) |
| Writes a neural network action to a file. | |
| size_t | act_neural_load (const struct XCSF *xcsf, struct Cl *c, FILE *fp) |
| Reads a neural network action from a file. | |
| char * | act_neural_json_export (const struct XCSF *xcsf, const struct Cl *c) |
| Returns a json formatted string representation of a neural action. | |
| void | act_neural_json_import (const struct XCSF *xcsf, struct Cl *c, const cJSON *json) |
| Creates a neural action from a cJSON object. | |
| 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.
Definition in file act_neural.c.
Computes the current neural network action using the input.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier calculating the action. |
| [in] | x | The input state. |
Definition at line 107 of file act_neural.c.
References Cl::act, argmax(), ActNeural::net, neural_outputs(), and neural_propagate().
Referenced by act_neural_cover().
Copies a neural network action from one classifier to another.
| [in] | xcsf | The XCSF data structure. |
| [in] | dest | The destination classifier. |
| [in] | src | The source classifier. |
Definition at line 122 of file act_neural.c.
References Cl::act, ActNeural::net, and neural_copy().
| void act_neural_cover | ( | const struct XCSF * | xcsf, |
| const struct Cl * | c, | ||
| const double * | x, | ||
| const int | action | ||
| ) |
Generates a neural network that covers the specified input:action.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose action is being covered. |
| [in] | x | The input state to cover. |
| [in] | action | The action to cover. |
Definition at line 152 of file act_neural.c.
References Cl::act, act_neural_compute(), ActNeural::net, and neural_rand().
Dummy function since crossover is not performed on neural actions.
| [in] | xcsf | The XCSF data structure. |
| [in] | c1 | The first classifier whose action is being crossed. |
| [in] | c2 | The second classifier whose action is being crossed. |
Definition at line 59 of file act_neural.c.
Frees the memory used by a neural network action.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose action is to be freed. |
Definition at line 167 of file act_neural.c.
References Cl::act, ActNeural::net, and neural_free().
Dummy function since neural actions do not generalise another.
| [in] | xcsf | The XCSF data structure. |
| [in] | c1 | The classifier whose action is tested to be more general. |
| [in] | c2 | The classifier whose action is tested to be more specific. |
Definition at line 76 of file act_neural.c.
Creates and initialises an action neural network.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose action is to be initialised. |
Definition at line 44 of file act_neural.c.
References Cl::act, and neural_create().
Returns a json formatted string representation of a neural action.
| [in] | xcsf | XCSF data structure. |
| [in] | c | Classifier whose action is to be returned. |
Definition at line 232 of file act_neural.c.
References Cl::act, ActNeural::net, and neural_json_export().
Referenced by act_neural_print().
Creates a neural action from a cJSON object.
| [in] | xcsf | The XCSF data structure. |
| [in,out] | c | The classifier to initialise. |
| [in] | json | cJSON object. |
Definition at line 254 of file act_neural.c.
References Cl::act, ActNeural::net, and neural_json_import().
Reads a neural network action from a file.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose action is to be read. |
| [in] | fp | Pointer to the file to be read. |
Definition at line 216 of file act_neural.c.
References Cl::act, and neural_load().
Mutates a neural network action.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose action is being mutated. |
Definition at line 92 of file act_neural.c.
References Cl::act, ActNeural::net, and neural_mutate().
| void act_neural_param_defaults | ( | struct XCSF * | xcsf | ) |
Initialises default neural action parameters.
| [in] | xcsf | The XCSF data structure. |
Definition at line 270 of file act_neural.c.
References CONNECTED, ArgsLayer::evolve_connect, ArgsLayer::evolve_neurons, ArgsLayer::evolve_weights, ArgsLayer::function, layer_args_copy(), layer_args_init(), LINEAR, LOGISTIC, ArgsLayer::max_neuron_grow, ArgsLayer::n_init, ArgsLayer::n_inputs, ArgsLayer::n_max, ArgsLayer::next, ArgsLayer::scale, SOFTMAX, and ArgsLayer::type.
Referenced by action_param_defaults().
| char * act_neural_param_json_import | ( | struct XCSF * | xcsf, |
| cJSON * | json | ||
| ) |
Sets the neural network parameters from a cJSON object.
| [in,out] | xcsf | The XCSF data structure. |
| [in] | json | cJSON object. |
Definition at line 305 of file act_neural.c.
References layer_args_free(), layer_args_init(), layer_args_json_import(), layer_args_validate(), ArgsLayer::n_inputs, and ArgsLayer::next.
Referenced by action_param_json_import().
Prints a neural network action.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose action is to be printed. |
Definition at line 137 of file act_neural.c.
References act_neural_json_export().
Writes a neural network action to a file.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose action is to be written. |
| [in] | fp | Pointer to the file to be written. |
Definition at line 200 of file act_neural.c.
References Cl::act, ActNeural::net, and neural_save().
| void act_neural_update | ( | const struct XCSF * | xcsf, |
| const struct Cl * | c, | ||
| const double * | x, | ||
| const double * | y | ||
| ) |
Dummy function since neural network actions are not updated.
| [in] | xcsf | The XCSF data structure. |
| [in] | c | The classifier whose action is to be updated. |
| [in] | x | The input state. |
| [in] | y | The payoff value. |
Definition at line 183 of file act_neural.c.