XCSF
1.4.7
XCSF learning classifier system
|
Multi-layer perceptron neural network condition functions. More...
#include "condition.h"
#include "neural.h"
#include "neural_activations.h"
#include "neural_layer.h"
#include "xcsf.h"
Go to the source code of this file.
Data Structures | |
struct | CondNeural |
Multi-layer perceptron neural network condition data structure. More... | |
Functions | |
char * | cond_neural_param_json_import (struct XCSF *xcsf, cJSON *json) |
Sets the neural network parameters from a cJSON object. More... | |
void | cond_neural_param_defaults (struct XCSF *xcsf) |
Initialises default neural condition parameters. More... | |
bool | cond_neural_crossover (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
Dummy crossover function. More... | |
bool | cond_neural_general (const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2) |
Dummy general function. More... | |
bool | cond_neural_match (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
Generates a neural network that matches the current input. More... | |
bool | cond_neural_mutate (const struct XCSF *xcsf, const struct Cl *c) |
Mutates a neural network condition with the self-adaptive rates. More... | |
void | cond_neural_copy (const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src) |
Copies a neural network condition from one classifier to another. More... | |
void | cond_neural_cover (const struct XCSF *xcsf, const struct Cl *c, const double *x) |
Generates a neural network that matches the current input. More... | |
void | cond_neural_free (const struct XCSF *xcsf, const struct Cl *c) |
Frees the memory used by a neural network condition. More... | |
void | cond_neural_init (const struct XCSF *xcsf, struct Cl *c) |
Creates and initialises a neural network condition. More... | |
void | cond_neural_print (const struct XCSF *xcsf, const struct Cl *c) |
Prints a neural network condition. More... | |
void | cond_neural_update (const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y) |
Dummy update function. More... | |
double | cond_neural_size (const struct XCSF *xcsf, const struct Cl *c) |
Returns the size of a neural network condition. More... | |
size_t | cond_neural_save (const struct XCSF *xcsf, const struct Cl *c, FILE *fp) |
Writes a neural network condition to a file. More... | |
size_t | cond_neural_load (const struct XCSF *xcsf, struct Cl *c, FILE *fp) |
Reads a neural network condition from a file. More... | |
int | cond_neural_neurons (const struct XCSF *xcsf, const struct Cl *c, int layer) |
Returns the number of neurons in a neural condition layer. More... | |
int | cond_neural_layers (const struct XCSF *xcsf, const struct Cl *c) |
Returns the number of layers within a neural network condition. More... | |
int | cond_neural_connections (const struct XCSF *xcsf, const struct Cl *c, int layer) |
Returns the number of active connections in a neural condition layer. More... | |
char * | cond_neural_json_export (const struct XCSF *xcsf, const struct Cl *c) |
Returns a json formatted string representation of a neural condition. More... | |
void | cond_neural_json_import (const struct XCSF *xcsf, struct Cl *c, const cJSON *json) |
Creates a neural condition from a cJSON object. More... | |
Variables | |
static struct CondVtbl const | cond_neural_vtbl |
Multi-layer perceptron neural network condition implemented functions. More... | |
Multi-layer perceptron neural network condition functions.
Definition in file cond_neural.h.
Returns the number of active connections in a neural condition layer.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier maintaining a neural network condition. |
[in] | layer | Position of a layer in the network. |
Definition at line 273 of file cond_neural.c.
References Cl::cond, Llist::layer, Layer::n_active, CondNeural::net, Llist::prev, and Net::tail.
Referenced by clset_mean_cond_connections().
Copies a neural network condition from one classifier to another.
[in] | xcsf | XCSF data structure. |
[in] | dest | Destination classifier. |
[in] | src | Source classifier. |
Definition at line 70 of file cond_neural.c.
References Cl::cond, CondNeural::net, and neural_copy().
Generates a neural network that matches the current input.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is being covered. |
[in] | x | Input state to cover. |
Definition at line 86 of file cond_neural.c.
References Cl::cond, cond_neural_match(), CondNeural::net, and neural_rand().
Dummy crossover function.
[in] | xcsf | XCSF data structure. |
[in] | c1 | First classifier whose condition is being crossed. |
[in] | c2 | Second classifier whose condition is being crossed. |
Definition at line 150 of file cond_neural.c.
Frees the memory used by a neural network condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be freed. |
Definition at line 55 of file cond_neural.c.
References Cl::cond, CondNeural::net, and neural_free().
Dummy general function.
[in] | xcsf | XCSF data structure. |
[in] | c1 | Classifier whose condition is tested to be more general. |
[in] | c2 | Classifier whose condition is tested to be more specific. |
Definition at line 167 of file cond_neural.c.
Creates and initialises a neural network condition.
[in] | xcsf | The XCSF data structure. |
[in] | c | The classifier whose condition is to be initialised. |
Definition at line 42 of file cond_neural.c.
References Cl::cond, and neural_create().
Returns a json formatted string representation of a neural condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be returned. |
Definition at line 312 of file cond_neural.c.
References Cl::cond, CondNeural::net, and neural_json_export().
Referenced by cond_neural_print().
Creates a neural condition from a cJSON object.
[in] | xcsf | The XCSF data structure. |
[in,out] | c | The classifier to initialise. |
[in] | json | cJSON object. |
Definition at line 334 of file cond_neural.c.
References Cl::cond, CondNeural::net, and neural_json_import().
Returns the number of layers within a neural network condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier maintaining a neural network condition. |
Definition at line 297 of file cond_neural.c.
References Cl::cond, Net::n_layers, and CondNeural::net.
Referenced by clset_mean_cond_layers().
Reads a neural network condition from a file.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be read. |
[in] | fp | Pointer to the file to be read. |
Definition at line 228 of file cond_neural.c.
References Cl::cond, and neural_load().
Generates a neural network that matches the current input.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is being covered. |
[in] | x | Input state to cover. |
Definition at line 118 of file cond_neural.c.
References Cl::cond, CondNeural::net, neural_output(), and neural_propagate().
Referenced by cond_neural_cover().
Mutates a neural network condition with the self-adaptive rates.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is being mutated. |
Definition at line 135 of file cond_neural.c.
References Cl::cond, CondNeural::net, and neural_mutate().
Returns the number of neurons in a neural condition layer.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier maintaining a neural network prediction. |
[in] | layer | Position of a layer in the network. |
Definition at line 245 of file cond_neural.c.
References Cl::cond, CONVOLUTIONAL, Llist::layer, Layer::n_filters, Layer::n_outputs, CondNeural::net, Llist::prev, Net::tail, and Layer::type.
Referenced by clset_mean_cond_neurons().
void cond_neural_param_defaults | ( | struct XCSF * | xcsf | ) |
Initialises default neural condition parameters.
[in] | xcsf | The XCSF data structure. |
Definition at line 383 of file cond_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, and ArgsLayer::type.
Referenced by cond_param_defaults().
char* cond_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 353 of file cond_neural.c.
References layer_args_free(), layer_args_init(), layer_args_json_import(), layer_args_validate(), ArgsLayer::n_inputs, and ArgsLayer::next.
Referenced by cond_param_json_import().
Prints a neural network condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be printed. |
Definition at line 182 of file cond_neural.c.
References cond_neural_json_export().
Writes a neural network condition to a file.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be written. |
[in] | fp | Pointer to the file to be written. |
Definition at line 212 of file cond_neural.c.
References Cl::cond, CondNeural::net, and neural_save().
Returns the size of a neural network condition.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition size to return. |
Definition at line 197 of file cond_neural.c.
References Cl::cond, CondNeural::net, and neural_size().
void cond_neural_update | ( | const struct XCSF * | xcsf, |
const struct Cl * | c, | ||
const double * | x, | ||
const double * | y | ||
) |
Dummy update function.
[in] | xcsf | XCSF data structure. |
[in] | c | Classifier whose condition is to be updated. |
[in] | x | Input state. |
[in] | y | Truth/payoff value. |
Definition at line 102 of file cond_neural.c.
|
static |
Multi-layer perceptron neural network condition implemented functions.
Definition at line 101 of file cond_neural.h.
Referenced by condition_set().