comparison toolboxes/FullBNT-1.0.7/netlab3.3/rbfunpak.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 net = rbfunpak(net, w)
2 %RBFUNPAK Separates a vector of RBF weights into its components.
3 %
4 % Description
5 % NET = RBFUNPAK(NET, W) takes an RBF network data structure NET and a
6 % weight vector W, and returns a network data structure identical to
7 % the input network, except that the centres C, the widths WI, the
8 % second-layer weight matrix W2 and the second-layer bias vector B2
9 % have all been set to the corresponding elements of W.
10 %
11 % See also
12 % RBFPAK, RBF
13 %
14
15 % Copyright (c) Ian T Nabney (1996-2001)
16
17 % Check arguments for consistency
18 errstring = consist(net, 'rbf');
19 if ~errstring
20 error(errstring);
21 end
22
23 if net.nwts ~= length(w)
24 error('Invalid length of weight vector')
25 end
26
27 nin = net.nin;
28 nhidden = net.nhidden;
29 nout = net.nout;
30
31 mark1 = nin*nhidden;
32 net.c = reshape(w(1:mark1), nhidden, nin);
33 if strcmp(net.actfn, 'gaussian')
34 mark2 = mark1 + nhidden;
35 net.wi = reshape(w(mark1+1:mark2), 1, nhidden);
36 else
37 mark2 = mark1;
38 net.wi = [];
39 end
40 mark3 = mark2 + nhidden*nout;
41 net.w2 = reshape(w(mark2+1:mark3), nhidden, nout);
42 mark4 = mark3 + nout;
43 net.b2 = reshape(w(mark3+1:mark4), 1, nout);