comparison toolboxes/FullBNT-1.0.7/netlab3.3/rbfderiv.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 = rbfderiv(net, x)
2 %RBFDERIV Evaluate derivatives of RBF network outputs with respect to weights.
3 %
4 % Description
5 % G = RBFDERIV(NET, X) takes a network data structure NET and a matrix
6 % of input vectors X and returns a three-index matrix G whose I, J, K
7 % element contains the derivative of network output K with respect to
8 % weight or bias parameter J for input pattern I. The ordering of the
9 % weight and bias parameters is defined by RBFUNPAK. This function
10 % also takes into account any mask in the network data structure.
11 %
12 % See also
13 % RBF, RBFPAK, RBFGRAD, RBFBKP
14 %
15
16 % Copyright (c) Ian T Nabney (1996-2001)
17
18 % Check arguments for consistency
19 errstring = consist(net, 'rbf', x);
20 if ~isempty(errstring);
21 error(errstring);
22 end
23
24 if ~strcmp(net.outfn, 'linear')
25 error('Function only implemented for linear outputs')
26 end
27
28 [y, z, n2] = rbffwd(net, x);
29 ndata = size(x, 1);
30
31 if isfield(net, 'mask')
32 nwts = size(find(net.mask), 1);
33 temp = zeros(1, net.nwts);
34 else
35 nwts = net.nwts;
36 end
37
38 g = zeros(ndata, nwts, net.nout);
39 for k = 1 : net.nout
40 delta = zeros(1, net.nout);
41 delta(1, k) = 1;
42 for n = 1 : ndata
43 if isfield(net, 'mask')
44 temp = rbfbkp(net, x(n, :), z(n, :), n2(n, :), delta);
45 g(n, :, k) = temp(logical(net.mask));
46 else
47 g(n, :, k) = rbfbkp(net, x(n, :), z(n, :), n2(n, :),...
48 delta);
49 end
50 end
51 end
52
53