108 neural_learn(
const struct Net *net,
const double *output,
const double *input);
double * neural_outputs(const struct Net *net)
Returns the outputs from the output layer of a neural network.
void neural_push(struct Net *net, struct Layer *l)
Inserts a layer at the head of a neural network.
void neural_learn(const struct Net *net, const double *output, const double *input)
Performs a gradient descent update on a neural network.
bool neural_mutate(const struct Net *net)
Mutates a neural network.
double neural_size(const struct Net *net)
Returns the total number of non-zero weights in a neural network.
void neural_create(struct Net *net, struct ArgsLayer *arg)
Initialises and creates a new neural network from a parameter list.
double neural_output(const struct Net *net, const int IDX)
Returns the output of a specified neuron in the output layer of a neural network.
void neural_resize(const struct Net *net)
Resizes neural network layers as necessary.
size_t neural_load(struct Net *net, FILE *fp)
Reads a neural network from a file.
void neural_json_import(struct Net *net, const struct ArgsLayer *arg, const cJSON *json)
Creates a neural network from a cJSON object.
void neural_free(struct Net *net)
Frees a neural network.
void neural_remove(struct Net *net, const int pos)
Removes a layer from a neural network.
void neural_print(const struct Net *net, const bool print_weights)
Prints a neural network.
void neural_rand(const struct Net *net)
Randomises the layers within a neural network.
void neural_copy(struct Net *dest, const struct Net *src)
Copies a neural network.
void neural_init(struct Net *net)
Initialises an empty neural network.
void neural_propagate(struct Net *net, const double *input, const bool train)
Forward propagates a neural network.
char * neural_json_export(const struct Net *net, const bool return_weights)
Returns a json formatted string representation of a neural network.
void neural_pop(struct Net *net)
Removes the layer at the head of a neural network.
size_t neural_save(const struct Net *net, FILE *fp)
Writes a neural network to a file.
void neural_insert(struct Net *net, struct Layer *l, const int pos)
Inserts a layer into a neural network.
Parameters for initialising a neural network layer.
Neural network layer data structure.
Forward declaration of layer structure.
struct Llist * prev
Pointer to the previous layer (forward)
struct Layer * layer
Pointer to the layer data structure.
struct Llist * next
Pointer to the next layer (backward)
Neural network data structure.
int n_layers
Number of layers (hidden + output)
double * output
Pointer to the network output.
struct Llist * tail
Pointer to the tail layer (first layer)
struct Llist * head
Pointer to the head layer (output layer)
bool train
Whether the network is in training mode.
int n_outputs
Number of network outputs.
int n_inputs
Number of network inputs.
Utility functions for random number handling, etc.