20#include <learning/learn_debug.h>
21#include <learning/string_utils.h>
22#include <learning/List.h>
23#include <learning/real.h>
108extern ANN*
NewANN(
int n_inputs,
int n_outputs);
int ANN_AddHiddenLayer(ANN *ann, int n_nodes)
Add a hidden layer with n_nodes.
real ANN_LayerShowInputs(Layer *l)
Dump inputs to a particular layer on stdout.
void ANN_FreeLayer(void *l)
Free this layer - low level.
void ANN_SetLearningRate(ANN *ann, real a)
Set the learning rate to a.
struct Layer_ Layer
A collection of connections from one layer to another, plus management functions and data.
real htan(real x)
Hyperbolic tangent hook.
real linear_d(real x)
linear derivative hook
void ANN_LayerBatchAdapt(Layer *l)
Perform batch adaptation.
ANN * NewANN(int n_inputs, int n_outputs)
Create a new ANN.
void ANN_SetOutputsToTanH(ANN *ann)
Set outputs to hyperbolic tangent.
real ANN_Input(ANN *ann, real *x)
Give an input vector to the neural network.
int ANN_Init(ANN *ann)
Initialise neural network.
real ANN_ShowInputs(ANN *ann)
Dump inputs to all layers on stdout.
real Exp(real x)
Exponential hook.
real ANN_Backpropagate(LISTITEM *p, real *d, bool use_eligibility=false, real TD=0.0)
d are the derivatives at the outputs.
real dtan(real x)
Discrete htan hook.
int ANN_AddRBFHiddenLayer(ANN *ann, int n_nodes)
Add an RBF layer with n_nodes.
real ANN_RBFBackpropagate(LISTITEM *p, real *d, bool use_eligibility=false, real TD=0.0)
Backpropagation for an RBF layer.
void ANN_SetLambda(ANN *ann, real lambda)
Set lambda, eligibility decay.
real Exp_d(real x)
Exponential derivative hook.
Layer * ANN_AddRBFLayer(ANN *ann, int n_inputs, int n_outputs, real *x)
Low-level code to add an RBF layer.
void ANN_ShowOutputs(ANN *ann)
Dump outputs to stdout.
real linear(real x)
linear hook
void ANN_SetZeta(ANN *ann, real lambda)
Set zeta, parameter variance smoothing.
real htan_d(real x)
Hyperbolic tangent derivative hook.
struct Connection_ Connection
A linear connection between two neural elements.
int SaveANN(ANN *ann, char *filename)
Save the ANN to a filename.
void ANN_SetBatchMode(ANN *ann, bool batch)
Set batch updates.
void ANN_CalculateLayerOutputs(Layer *current_layer, bool stochastic=false)
Calculate layer outputs.
real dtan_d(real x)
Discrete htan derivative hook.
void ANN_Reset(ANN *ann)
Resets the eligbility traces and batch updates.
Layer * ANN_AddLayer(ANN *ann, int n_inputs, int n_outputs, real *x)
Low-level code to add a weighted sum layer.
void ANN_BatchAdapt(ANN *ann)
Adapt the parameters after a series of patterns has been seen.
void ANN_SetOutputsToLinear(ANN *ann)
Set outputs to linear.
struct ANN_ ANN
ANN management structure.
real ANN_Test(ANN *ann, real *x, real *t)
Given an input and test pattern, return the MSE between the network's output and the test pattern.
int DeleteANN(ANN *ann)
Delete a neural network.
real ANN_LayerShowWeights(Layer *l)
Dump the weights of a particular layer on stdout.
real ANN_Delta_Train(ANN *ann, real *delta, real TD=0.0)
Minimise a custom cost function.
real ANN_StochasticInput(ANN *ann, real *x)
Stochastically generate an output, depending on parameter distributions.
real ANN_Train(ANN *ann, real *x, real *t)
Perform mean square error training, where the aim is to minimise the cost function ,...
ANN * LoadANN(char *filename)
Load an ANN from a filename.
void ANN_RBFCalculateLayerOutputs(Layer *current_layer, bool stochastic=false)
Calculate layer outputs.
real ANN_GetError(ANN *ann)
Get the error for the current input/output pair.
struct RBFConnection_ RBFConnection
An RBF connection between two neural elements.
real * ANN_GetErrorVector(ANN *ann)
Return the error vector for pattern.
real ANN_ShowWeights(ANN *ann)
Dump the weights on stdout.
real * ANN_GetOutput(ANN *ann)
Get the output for the current input.
struct ListItem LISTITEM
A list item.
struct List LIST
A very simple list structure.
ANN management structure.
bool eligibility_traces
use eligibility
bool batch_mode
use batch mode
real lambda
eligibility trace decay
real zeta
variance update smoothness
int n_inputs
number of inputs
LIST * c
connection layers
int n_outputs
number of outputs
A linear connection between two neural elements.
A collection of connections from one layer to another, plus management functions and data.
real(* f_d)(real x)
derivative of activation function
int n_inputs
number of inputs
real lambda
eligibility decay
void(* forward)(struct Layer_ *current_layer, bool stochastic)
forward calculation
bool batch_mode
do not update weights immediately
real zeta
variance update smoothness.
int n_outputs
number of outputs
Connection * c
connections
RBFConnection * rbf
rbf connections (if any)
real(* f)(real x)
activation function
real(* backward)(LISTITEM *p, real *d, bool use_eligibility, real TD)
partial derivative calculation
An RBF connection between two neural elements.