comparison toolboxes/FullBNT-1.0.7/netlab3.3/mlpgrad.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function [g, gdata, gprior] = mlpgrad(net, x, t)
2 %MLPGRAD Evaluate gradient of error function for 2-layer network.
3 %
4 % Description
5 % G = MLPGRAD(NET, X, T) takes a network data structure NET together
6 % with a matrix X of input vectors and a matrix T of target vectors,
7 % and evaluates the gradient G of the error function with respect to
8 % the network weights. The error funcion corresponds to the choice of
9 % output unit activation function. Each row of X corresponds to one
10 % input vector and each row of T corresponds to one target vector.
11 %
12 % [G, GDATA, GPRIOR] = MLPGRAD(NET, X, T) also returns separately the
13 % data and prior contributions to the gradient. In the case of multiple
14 % groups in the prior, GPRIOR is a matrix with a row for each group and
15 % a column for each weight parameter.
16 %
17 % See also
18 % MLP, MLPPAK, MLPUNPAK, MLPFWD, MLPERR, MLPBKP
19 %
20
21 % Copyright (c) Ian T Nabney (1996-2001)
22
23 % Check arguments for consistency
24 errstring = consist(net, 'mlp', x, t);
25 if ~isempty(errstring);
26 error(errstring);
27 end
28 [y, z] = mlpfwd(net, x);
29 delout = y - t;
30
31 gdata = mlpbkp(net, x, z, delout);
32
33 [g, gdata, gprior] = gbayes(net, gdata);