ann_FF_grad — error gradient trough finite differences.
grad_E The error gradient, same layout as W. x Input patterns, one per column.
t Target patterns, one per column. Each column have a correspondent column in x.
N Row vector describing the number of neurons per layer. N(1) is the size of input pattern vector, N(size(N,'c')) is the size of output pattern vector (and also target).
W The weight hypermatrix.
dW The quantity used to perturb each W parameter.
af The name of activation function to be used (string). This parameter is optional, default value "ann_log_activ", i.e. the logistic activation function.
ef The name of error function to be used (string). This parameter is optional, default value "ann_sum_of_sqr", i.e. the sum-of-squares error function.
Calculates error gradient trough a (slow) finite differences procedure. Each element W(n,i,l) is changed to W(n,i,l)-dW then the error is calculated and the process is repeated for W(n,i,l)+dW.
From the values obtained the partial derivative of the sum-of-squares error function, with respect to W(n,i,l), is calculated and the value of gradient returned.
This process is very slow (compared to the backpropagation algorithms) so it is to be used only for testing purposes.