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