Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/netlab3.3/glmunpak.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 function net = glmunpak(net, w) |
wolffd@0 | 2 %GLMUNPAK Separates weights vector into weight and bias matrices. |
wolffd@0 | 3 % |
wolffd@0 | 4 % Description |
wolffd@0 | 5 % NET = GLMUNPAK(NET, W) takes a glm network data structure NET and a |
wolffd@0 | 6 % weight vector W, and returns a network data structure identical to |
wolffd@0 | 7 % the input network, except that the first-layer weight matrix W1 and |
wolffd@0 | 8 % the first-layer bias vector B1 have been set to the corresponding |
wolffd@0 | 9 % elements of W. |
wolffd@0 | 10 % |
wolffd@0 | 11 % See also |
wolffd@0 | 12 % GLM, GLMPAK, GLMFWD, GLMERR, GLMGRAD |
wolffd@0 | 13 % |
wolffd@0 | 14 |
wolffd@0 | 15 % Copyright (c) Ian T Nabney (1996-2001) |
wolffd@0 | 16 |
wolffd@0 | 17 % Check arguments for consistency |
wolffd@0 | 18 errstring = consist(net, 'glm'); |
wolffd@0 | 19 if ~errstring |
wolffd@0 | 20 error(errstring); |
wolffd@0 | 21 end |
wolffd@0 | 22 |
wolffd@0 | 23 if net.nwts ~= length(w) |
wolffd@0 | 24 error('Invalid weight vector length') |
wolffd@0 | 25 end |
wolffd@0 | 26 |
wolffd@0 | 27 nin = net.nin; |
wolffd@0 | 28 nout = net.nout; |
wolffd@0 | 29 net.w1 = reshape(w(1:nin*nout), nin, nout); |
wolffd@0 | 30 net.b1 = reshape(w(nin*nout + 1: (nin + 1)*nout), 1, nout); |