XCSF
1.4.7
XCSF learning classifier system
|
An implementation of a Gaussian noise adding layer. More...
#include "neural_layer.h"
Go to the source code of this file.
Functions | |
void | neural_layer_noise_init (struct Layer *l, const struct ArgsLayer *args) |
Initialises a noise layer. More... | |
struct Layer * | neural_layer_noise_copy (const struct Layer *src) |
Initialises and creates a copy of one noise layer from another. More... | |
void | neural_layer_noise_rand (struct Layer *l) |
Dummy function since noise layers have no weights. More... | |
void | neural_layer_noise_forward (const struct Layer *l, const struct Net *net, const double *input) |
Forward propagates a noise layer. More... | |
void | neural_layer_noise_backward (const struct Layer *l, const struct Net *net, const double *input, double *delta) |
Backward propagates a noise layer. More... | |
void | neural_layer_noise_update (const struct Layer *l) |
Dummy function since a noise layer has no weights. More... | |
void | neural_layer_noise_print (const struct Layer *l, const bool print_weights) |
Prints a noise layer. More... | |
bool | neural_layer_noise_mutate (struct Layer *l) |
Dummy function since a noise layer cannot be mutated. More... | |
void | neural_layer_noise_free (const struct Layer *l) |
Free memory used by a noise layer. More... | |
double * | neural_layer_noise_output (const struct Layer *l) |
Returns the output from a noise layer. More... | |
size_t | neural_layer_noise_save (const struct Layer *l, FILE *fp) |
Writes a noise layer to a file. More... | |
size_t | neural_layer_noise_load (struct Layer *l, FILE *fp) |
Reads a noise layer from a file. More... | |
void | neural_layer_noise_resize (struct Layer *l, const struct Layer *prev) |
Resizes a noise layer if the previous layer has changed size. More... | |
char * | neural_layer_noise_json_export (const struct Layer *l, const bool return_weights) |
Returns a json formatted string representation of a noise layer. More... | |
Variables | |
static struct LayerVtbl const | layer_noise_vtbl |
Neural Gaussian noise layer implemented functions. More... | |
An implementation of a Gaussian noise adding layer.
Definition in file neural_layer_noise.h.
void neural_layer_noise_backward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input, | ||
double * | delta | ||
) |
Backward propagates a noise 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 154 of file neural_layer_noise.c.
References Layer::delta, Layer::i, and Layer::n_inputs.
Initialises and creates a copy of one noise layer from another.
[in] | src | The source layer. |
Definition at line 78 of file neural_layer_noise.c.
References layer_defaults(), Layer::layer_vptr, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, NOISE, Layer::out_c, Layer::out_h, Layer::out_w, Layer::probability, Layer::scale, and Layer::type.
void neural_layer_noise_forward | ( | const struct Layer * | l, |
const struct Net * | net, | ||
const double * | input | ||
) |
Forward propagates a noise layer.
[in] | l | Layer to forward propagate. |
[in] | net | Network containing the layer. |
[in] | input | Input to the layer. |
Definition at line 127 of file neural_layer_noise.c.
References Layer::i, Layer::n_inputs, Layer::output, Layer::probability, rand_normal(), rand_uniform(), Layer::scale, Layer::state, and Net::train.
void neural_layer_noise_free | ( | const struct Layer * | l | ) |
Free memory used by a noise layer.
[in] | l | The layer to be freed. |
Definition at line 105 of file neural_layer_noise.c.
References free_layer_arrays().
Initialises a noise layer.
[in] | l | Layer to initialise. |
[in] | args | Parameters to initialise the layer. |
Definition at line 59 of file neural_layer_noise.c.
References ArgsLayer::channels, ArgsLayer::height, malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, ArgsLayer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::probability, ArgsLayer::probability, Layer::scale, ArgsLayer::scale, and ArgsLayer::width.
char* neural_layer_noise_json_export | ( | const struct Layer * | l, |
const bool | return_weights | ||
) |
Returns a json formatted string representation of a noise layer.
[in] | l | The layer to return. |
[in] | return_weights | Whether to return the values of weights and biases. |
Definition at line 238 of file neural_layer_noise.c.
References Layer::n_inputs, Layer::n_outputs, Layer::probability, and Layer::scale.
Referenced by neural_layer_noise_print().
size_t neural_layer_noise_load | ( | struct Layer * | l, |
FILE * | fp | ||
) |
Reads a noise layer from a file.
[in] | l | The layer to load. |
[in] | fp | Pointer to the file to be read. |
Definition at line 280 of file neural_layer_noise.c.
References malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::probability, and Layer::scale.
bool neural_layer_noise_mutate | ( | struct Layer * | l | ) |
Dummy function since a noise layer cannot be mutated.
[in] | l | A noise layer. |
Definition at line 182 of file neural_layer_noise.c.
double* neural_layer_noise_output | ( | const struct Layer * | l | ) |
Returns the output from a noise layer.
[in] | l | The layer whose output to return. |
Definition at line 212 of file neural_layer_noise.c.
References Layer::output.
void neural_layer_noise_print | ( | const struct Layer * | l, |
const bool | print_weights | ||
) |
Prints a noise layer.
[in] | l | The layer to print. |
[in] | print_weights | Whether to print the values of weights and biases. |
Definition at line 223 of file neural_layer_noise.c.
References neural_layer_noise_json_export().
void neural_layer_noise_rand | ( | struct Layer * | l | ) |
Dummy function since noise layers have no weights.
[in] | l | A softmax layer. |
Definition at line 115 of file neural_layer_noise.c.
Resizes a noise 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 194 of file neural_layer_noise.c.
References free_layer_arrays(), malloc_layer_arrays(), Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, and Layer::out_w.
size_t neural_layer_noise_save | ( | const struct Layer * | l, |
FILE * | fp | ||
) |
Writes a noise layer to a file.
[in] | l | The layer to save. |
[in] | fp | Pointer to the file to be written. |
Definition at line 259 of file neural_layer_noise.c.
References Layer::max_outputs, Layer::n_inputs, Layer::n_outputs, Layer::out_c, Layer::out_h, Layer::out_w, Layer::probability, and Layer::scale.
void neural_layer_noise_update | ( | const struct Layer * | l | ) |
Dummy function since a noise layer has no weights.
[in] | l | A noise layer. |
Definition at line 171 of file neural_layer_noise.c.
|
static |
Neural Gaussian noise layer implemented functions.
Definition at line 70 of file neural_layer_noise.h.
Referenced by layer_set_vptr().