comparison toolboxes/FullBNT-1.0.7/netlab3.3/glmunpak.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cc4b1211e677
1 function net = glmunpak(net, w)
2 %GLMUNPAK Separates weights vector into weight and bias matrices.
3 %
4 % Description
5 % NET = GLMUNPAK(NET, W) takes a glm 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 first-layer weight matrix W1 and
8 % the first-layer bias vector B1 have been set to the corresponding
9 % elements of W.
10 %
11 % See also
12 % GLM, GLMPAK, GLMFWD, GLMERR, GLMGRAD
13 %
14
15 % Copyright (c) Ian T Nabney (1996-2001)
16
17 % Check arguments for consistency
18 errstring = consist(net, 'glm');
19 if ~errstring
20 error(errstring);
21 end
22
23 if net.nwts ~= length(w)
24 error('Invalid weight vector length')
25 end
26
27 nin = net.nin;
28 nout = net.nout;
29 net.w1 = reshape(w(1:nin*nout), nin, nout);
30 net.b1 = reshape(w(nin*nout + 1: (nin + 1)*nout), 1, nout);