annotate toolboxes/FullBNT-1.0.7/netlab3.3/netpak.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 w = netpak(net)
wolffd@0 2 %NETPAK Combines weights and biases into one weights vector.
wolffd@0 3 %
wolffd@0 4 % Description
wolffd@0 5 % W = NETPAK(NET) takes a network data structure NET and combines the
wolffd@0 6 % component weight matrices into a single row vector W. The facility
wolffd@0 7 % to switch between these two representations for the network
wolffd@0 8 % parameters is useful, for example, in training a network by error
wolffd@0 9 % function minimization, since a single vector of parameters can be
wolffd@0 10 % handled by general-purpose optimization routines. This function also
wolffd@0 11 % takes into account a MASK defined as a field in NET by removing any
wolffd@0 12 % weights that correspond to entries of 0 in the mask.
wolffd@0 13 %
wolffd@0 14 % See also
wolffd@0 15 % NET, NETUNPAK, NETFWD, NETERR, NETGRAD
wolffd@0 16 %
wolffd@0 17
wolffd@0 18 % Copyright (c) Ian T Nabney (1996-2001)
wolffd@0 19
wolffd@0 20 pakstr = [net.type, 'pak'];
wolffd@0 21 w = feval(pakstr, net);
wolffd@0 22 % Return masked subset of weights
wolffd@0 23 if (isfield(net, 'mask'))
wolffd@0 24 w = w(logical(net.mask));
wolffd@0 25 end