XCSF
1.4.7
XCSF learning classifier system
|
An implementation of a recurrent layer of perceptrons. More...
#include "neural_layer.h"
Go to the source code of this file.
Functions | |
void | neural_layer_recurrent_init (struct Layer *l, const struct ArgsLayer *args) |
Initialises a recurrent layer. More... | |
struct Layer * | neural_layer_recurrent_copy (const struct Layer *src) |
Initialises and creates a copy of one recurrent layer from another. More... | |
void | neural_layer_recurrent_rand (struct Layer *l) |
Randomises a recurrent layer weights. More... | |
void | neural_layer_recurrent_forward (const struct Layer *l, const struct Net *net, const double *input) |
Forward propagates a recurrent layer. More... | |
void | neural_layer_recurrent_backward (const struct Layer *l, const struct Net *net, const double *input, double *delta) |
Backward propagates a recurrent layer. More... | |
void | neural_layer_recurrent_update (const struct Layer *l) |
Updates the weights and biases of a recurrent layer. More... | |
void | neural_layer_recurrent_print (const struct Layer *l, const bool print_weights) |
Prints a recurrent layer. More... | |
bool | neural_layer_recurrent_mutate (struct Layer *l) |
Mutates a recurrent layer. More... | |
void | neural_layer_recurrent_free (const struct Layer *l) |
Free memory used by a recurrent layer. More... | |
double * | neural_layer_recurrent_output (const struct Layer *l) |
Returns the output from a recurrent layer. More... | |
size_t | neural_layer_recurrent_save (const struct Layer *l, FILE *fp) |
Writes a recurrent layer to a file. More... | |
size_t | neural_layer_recurrent_load (struct Layer *l, FILE *fp) |
Reads a recurrent layer from a file. More... | |
void | neural_layer_recurrent_resize (struct Layer *l, const struct Layer *prev) |
Resizes a recurrent layer if the previous layer has changed size. More... | |
char * | neural_layer_recurrent_json_export (const struct Layer *l, const bool return_weights) |
Returns a json formatted string representation of a recurrent layer. More... | |
Variables | |
static struct LayerVtbl const | layer_recurrent_vtbl |
Neural recurrent layer implemented functions. More... | |
An implementation of a recurrent layer of perceptrons.
Definition in file neural_layer_recurrent.h.
void neural_layer_recurrent_backward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input, | ||
double * | delta | ||
) |
Backward propagates a recurrent layer.
[in] | l | The layer to backward propagate. |
[in] | net | Network containing the layer. |
[in] | input | The input to the layer. |
[out] | delta | The previous layer's error. |
Definition at line 368 of file neural_layer_recurrent.c.
References Layer::delta, Layer::input_layer, layer_backward(), Layer::n_outputs, Layer::output_layer, Layer::prev_state, Layer::self_layer, and Layer::state.
Initialises and creates a copy of one recurrent layer from another.
[in] | src | The source layer. |
Definition at line 283 of file neural_layer_recurrent.c.
References Layer::delta, Layer::eta, Layer::function, Layer::input_layer, layer_copy(), layer_defaults(), Layer::layer_vptr, malloc_layer_arrays(), Layer::max_outputs, Layer::mu, Layer::n_active, Layer::n_inputs, N_MU, Layer::n_outputs, Layer::options, Layer::out_c, Layer::out_h, Layer::out_w, Layer::output, Layer::output_layer, Layer::prev_state, RECURRENT, Layer::self_layer, and Layer::type.
void neural_layer_recurrent_forward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input | ||
) |
Forward propagates a recurrent layer.
[in] | l | Layer to forward propagate. |
[in] | net | Network containing the layer. |
[in] | input | Input to the layer. |
Definition at line 349 of file neural_layer_recurrent.c.
References blas_axpy(), Layer::input_layer, layer_forward(), Layer::n_outputs, Layer::output, Layer::output_layer, Layer::prev_state, Layer::self_layer, and Layer::state.
void neural_layer_recurrent_free | ( | const struct Layer * | l | ) |
Free memory used by a recurrent layer.
[in] | l | The layer to be freed. |
Definition at line 319 of file neural_layer_recurrent.c.
References free_layer_arrays(), Layer::input_layer, layer_free(), Layer::output_layer, and Layer::self_layer.
Initialises a recurrent layer.
[in] | l | Layer to initialise. |
[in] | args | Parameters to initialise the layer. |
Definition at line 246 of file neural_layer_recurrent.c.
References CONNECTED, Layer::delta, Layer::eta, Layer::function, ArgsLayer::function, Layer::input_layer, layer_args_copy(), layer_args_opt(), layer_init(), LINEAR, malloc_layer_arrays(), Layer::max_outputs, Layer::mu, MU_TYPE, ArgsLayer::n_init, Layer::n_inputs, ArgsLayer::n_inputs, ArgsLayer::n_max, N_MU, Layer::n_outputs, Layer::options, Layer::out_c, Layer::out_h, Layer::out_w, Layer::output, Layer::output_layer, sam_init(), Layer::self_layer, set_layer_n_active(), set_layer_n_biases(), set_layer_n_weights(), and ArgsLayer::type.
char* neural_layer_recurrent_json_export | ( | const struct Layer * | l, |
const bool | return_weights | ||
) |
Returns a json formatted string representation of a recurrent layer.
[in] | l | The layer to return. |
[in] | return_weights | Whether to return the values of weights and biases. |
Definition at line 458 of file neural_layer_recurrent.c.
References Layer::eta, Layer::function, Layer::input_layer, layer_weight_json(), Layer::mu, Layer::n_inputs, N_MU, Layer::n_outputs, neural_activation_string(), Layer::output_layer, and Layer::self_layer.
Referenced by neural_layer_recurrent_print().
size_t neural_layer_recurrent_load | ( | struct Layer * | l, |
FILE * | fp | ||
) |
Reads a recurrent layer from a file.
[in] | l | The layer to load. |
[in] | fp | Pointer to the file to be read. |
Definition at line 520 of file neural_layer_recurrent.c.
References Layer::eta, Layer::function, Layer::input_layer, layer_load(), malloc_layer_arrays(), malloc_layers(), Layer::max_outputs, Layer::mu, Layer::n_active, Layer::n_inputs, N_MU, Layer::n_outputs, Layer::options, Layer::out_c, Layer::out_h, Layer::out_w, Layer::output_layer, Layer::prev_state, Layer::self_layer, and Layer::state.
bool neural_layer_recurrent_mutate | ( | struct Layer * | l | ) |
Mutates a recurrent layer.
[in] | l | The layer to mutate. |
Definition at line 425 of file neural_layer_recurrent.c.
References Layer::mu, MU_TYPE, mutate_connectivity(), mutate_eta(), mutate_functions(), mutate_neurons(), mutate_weights(), N_MU, and sam_adapt().
double* neural_layer_recurrent_output | ( | const struct Layer * | l | ) |
Returns the output from a recurrent layer.
[in] | l | The layer whose output to return. |
Definition at line 414 of file neural_layer_recurrent.c.
References Layer::output.
void neural_layer_recurrent_print | ( | const struct Layer * | l, |
const bool | print_weights | ||
) |
Prints a recurrent layer.
[in] | l | The layer to print. |
[in] | print_weights | Whether to print the values of weights and biases. |
Definition at line 443 of file neural_layer_recurrent.c.
References neural_layer_recurrent_json_export().
void neural_layer_recurrent_rand | ( | struct Layer * | l | ) |
Randomises a recurrent layer weights.
[in] | l | The layer to randomise. |
Definition at line 335 of file neural_layer_recurrent.c.
References Layer::input_layer, layer_rand(), Layer::output_layer, and Layer::self_layer.
Resizes a recurrent layer if the previous layer has changed size.
[in] | l | The layer to resize. |
[in] | prev | The layer previous to the one being resized. |
Definition at line 400 of file neural_layer_recurrent.c.
References Layer::input_layer, layer_resize(), Layer::n_active, Layer::n_inputs, Layer::output_layer, and Layer::self_layer.
size_t neural_layer_recurrent_save | ( | const struct Layer * | l, |
FILE * | fp | ||
) |
Writes a recurrent layer to a file.
[in] | l | The layer to save. |
[in] | fp | Pointer to the file to be written. |
Definition at line 494 of file neural_layer_recurrent.c.
References Layer::eta, Layer::function, Layer::input_layer, layer_save(), Layer::max_outputs, Layer::mu, Layer::n_active, Layer::n_inputs, N_MU, Layer::n_outputs, Layer::options, Layer::output_layer, Layer::prev_state, Layer::self_layer, and Layer::state.
void neural_layer_recurrent_update | ( | const struct Layer * | l | ) |
Updates the weights and biases of a recurrent layer.
[in] | l | The layer to update. |
Definition at line 385 of file neural_layer_recurrent.c.
References Layer::eta, Layer::input_layer, LAYER_SGD_WEIGHTS, layer_update(), Layer::options, Layer::output_layer, and Layer::self_layer.
|
static |
Neural recurrent layer implemented functions.
Definition at line 70 of file neural_layer_recurrent.h.
Referenced by layer_set_vptr().