Daniel@0: function g = netgrad(w, net, x, t) Daniel@0: %NETGRAD Evaluate network error gradient for generic optimizers Daniel@0: % Daniel@0: % Description Daniel@0: % Daniel@0: % G = NETGRAD(W, NET, X, T) takes a weight vector W and a network data Daniel@0: % structure NET, together with the matrix X of input vectors and the Daniel@0: % matrix T of target vectors, and returns the gradient of the error Daniel@0: % function evaluated at W. Daniel@0: % Daniel@0: % See also Daniel@0: % MLP, NETERR, NETOPT Daniel@0: % Daniel@0: Daniel@0: % Copyright (c) Ian T Nabney (1996-2001) Daniel@0: Daniel@0: gradstr = [net.type, 'grad']; Daniel@0: Daniel@0: net = netunpak(net, w); Daniel@0: Daniel@0: g = feval(gradstr, net, x, t);