XCSF  1.4.7
XCSF learning classifier system
neural_layer_noise.h File Reference

An implementation of a Gaussian noise adding layer. More...

#include "neural_layer.h"
Include dependency graph for neural_layer_noise.h:
This graph shows which files directly or indirectly include this file:

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 Layerneural_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...
 

Detailed Description

An implementation of a Gaussian noise adding layer.

Author
Richard Preen rpree.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om
Date
2016–2021.

Definition in file neural_layer_noise.h.

Function Documentation

◆ neural_layer_noise_backward()

void neural_layer_noise_backward ( const struct Layer l,
const struct Net net,
const double *  input,
double *  delta 
)

Backward propagates a noise layer.

Parameters
[in]lThe layer to backward propagate.
[in]netNetwork containing the layer.
[in]inputThe input to the layer.
[out]deltaThe previous layer's error.

Definition at line 154 of file neural_layer_noise.c.

References Layer::delta, Layer::i, and Layer::n_inputs.

◆ neural_layer_noise_copy()

struct Layer* neural_layer_noise_copy ( const struct Layer src)

Initialises and creates a copy of one noise layer from another.

Parameters
[in]srcThe source layer.
Returns
A pointer to the new 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.

Here is the call graph for this function:

◆ neural_layer_noise_forward()

void neural_layer_noise_forward ( const struct Layer l,
const struct Net net,
const double *  input 
)

Forward propagates a noise layer.

Parameters
[in]lLayer to forward propagate.
[in]netNetwork containing the layer.
[in]inputInput 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.

Here is the call graph for this function:

◆ neural_layer_noise_free()

void neural_layer_noise_free ( const struct Layer l)

Free memory used by a noise layer.

Parameters
[in]lThe layer to be freed.

Definition at line 105 of file neural_layer_noise.c.

References free_layer_arrays().

Here is the call graph for this function:

◆ neural_layer_noise_init()

void neural_layer_noise_init ( struct Layer l,
const struct ArgsLayer args 
)

Initialises a noise layer.

Parameters
[in]lLayer to initialise.
[in]argsParameters 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.

Here is the call graph for this function:

◆ neural_layer_noise_json_export()

char* neural_layer_noise_json_export ( const struct Layer l,
const bool  return_weights 
)

Returns a json formatted string representation of a noise layer.

Parameters
[in]lThe layer to return.
[in]return_weightsWhether to return the values of weights and biases.
Returns
String encoded in json format.

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().

Here is the caller graph for this function:

◆ neural_layer_noise_load()

size_t neural_layer_noise_load ( struct Layer l,
FILE *  fp 
)

Reads a noise layer from a file.

Parameters
[in]lThe layer to load.
[in]fpPointer to the file to be read.
Returns
The number of elements 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.

Here is the call graph for this function:

◆ neural_layer_noise_mutate()

bool neural_layer_noise_mutate ( struct Layer l)

Dummy function since a noise layer cannot be mutated.

Parameters
[in]lA noise layer.
Returns
False.

Definition at line 182 of file neural_layer_noise.c.

◆ neural_layer_noise_output()

double* neural_layer_noise_output ( const struct Layer l)

Returns the output from a noise layer.

Parameters
[in]lThe layer whose output to return.
Returns
The layer output.

Definition at line 212 of file neural_layer_noise.c.

References Layer::output.

◆ neural_layer_noise_print()

void neural_layer_noise_print ( const struct Layer l,
const bool  print_weights 
)

Prints a noise layer.

Parameters
[in]lThe layer to print.
[in]print_weightsWhether to print the values of weights and biases.

Definition at line 223 of file neural_layer_noise.c.

References neural_layer_noise_json_export().

Here is the call graph for this function:

◆ neural_layer_noise_rand()

void neural_layer_noise_rand ( struct Layer l)

Dummy function since noise layers have no weights.

Parameters
[in]lA softmax layer.

Definition at line 115 of file neural_layer_noise.c.

◆ neural_layer_noise_resize()

void neural_layer_noise_resize ( struct Layer l,
const struct Layer prev 
)

Resizes a noise layer if the previous layer has changed size.

Parameters
[in]lThe layer to resize.
[in]prevThe 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.

Here is the call graph for this function:

◆ neural_layer_noise_save()

size_t neural_layer_noise_save ( const struct Layer l,
FILE *  fp 
)

Writes a noise layer to a file.

Parameters
[in]lThe layer to save.
[in]fpPointer to the file to be written.
Returns
The number of elements 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.

◆ neural_layer_noise_update()

void neural_layer_noise_update ( const struct Layer l)

Dummy function since a noise layer has no weights.

Parameters
[in]lA noise layer.

Definition at line 171 of file neural_layer_noise.c.

Variable Documentation

◆ layer_noise_vtbl

struct LayerVtbl const layer_noise_vtbl
static
Initial value:
= {
}
void neural_layer_noise_free(const struct Layer *l)
Free memory used by a noise layer.
void neural_layer_noise_rand(struct Layer *l)
Dummy function since noise layers have no weights.
void neural_layer_noise_print(const struct Layer *l, const bool print_weights)
Prints a noise layer.
void neural_layer_noise_resize(struct Layer *l, const struct Layer *prev)
Resizes a noise layer if the previous layer has changed size.
void neural_layer_noise_update(const struct Layer *l)
Dummy function since a noise layer has no weights.
void neural_layer_noise_init(struct Layer *l, const struct ArgsLayer *args)
Initialises a noise layer.
size_t neural_layer_noise_save(const struct Layer *l, FILE *fp)
Writes a noise layer to a file.
size_t neural_layer_noise_load(struct Layer *l, FILE *fp)
Reads a noise layer from a file.
char * neural_layer_noise_json_export(const struct Layer *l, const bool return_weights)
Returns a json formatted string representation of a noise layer.
void neural_layer_noise_backward(const struct Layer *l, const struct Net *net, const double *input, double *delta)
Backward propagates a noise layer.
struct Layer * neural_layer_noise_copy(const struct Layer *src)
Initialises and creates a copy of one noise layer from another.
bool neural_layer_noise_mutate(struct Layer *l)
Dummy function since a noise layer cannot be mutated.
void neural_layer_noise_forward(const struct Layer *l, const struct Net *net, const double *input)
Forward propagates a noise layer.
double * neural_layer_noise_output(const struct Layer *l)
Returns the output from a noise layer.

Neural Gaussian noise layer implemented functions.

Definition at line 70 of file neural_layer_noise.h.

Referenced by layer_set_vptr().