wolffd@0: function w = mlppak(net) wolffd@0: %MLPPAK Combines weights and biases into one weights vector. wolffd@0: % wolffd@0: % Description wolffd@0: % W = MLPPAK(NET) takes a network data structure NET and combines the wolffd@0: % component weight matrices bias vectors into a single row vector W. wolffd@0: % The facility to switch between these two representations for the wolffd@0: % network parameters is useful, for example, in training a network by wolffd@0: % error function minimization, since a single vector of parameters can wolffd@0: % be handled by general-purpose optimization routines. wolffd@0: % wolffd@0: % The ordering of the paramters in W is defined by wolffd@0: % w = [net.w1(:)', net.b1, net.w2(:)', net.b2]; wolffd@0: % where W1 is the first-layer weight matrix, B1 is the first-layer wolffd@0: % bias vector, W2 is the second-layer weight matrix, and B2 is the wolffd@0: % second-layer bias vector. wolffd@0: % wolffd@0: % See also wolffd@0: % MLP, MLPUNPAK, MLPFWD, MLPERR, MLPBKP, MLPGRAD wolffd@0: % wolffd@0: wolffd@0: % Copyright (c) Ian T Nabney (1996-2001) wolffd@0: wolffd@0: % Check arguments for consistency wolffd@0: errstring = consist(net, 'mlp'); wolffd@0: if ~isempty(errstring); wolffd@0: error(errstring); wolffd@0: end wolffd@0: wolffd@0: w = [net.w1(:)', net.b1, net.w2(:)', net.b2]; wolffd@0: