enc.m in pca_ann.rar
Sponsored links
function onet = enc(inputsize,mimax,hneurons,fcnCELL,initflag,trainalgo,paramatrix,sameWEIGHT)
%------------------------------------------------------------
% onet = enc(inputsize,scala,hneurons,fcnCELL,initflag,trainalgo,paramatrix)
%
%
% Creates and initializes a neural network with given parameters.
%
% ->inputsize = size of input data.(actually the total number of
% pixels in our images)
% ->std_norm = 1 if we want to normalize inputs with mean=0 and std=1, 0 otherwise.
% ->mimax = minimum & maximum value of all returned matrices (use when initializing a net)
% ->hneurons = number of neurons at hidden layer.
% ->fcnCELL= a 1x2 vector with the names of the transfer functions
% at hidden and output layer.
% ->initflag = a 1x2 vector with the desired initialization method
% at hidden and output layer.(0=zero weights, 1=random).
% ->trainalgo = name of the training algorithm (for now gradient
% descent and gradient descent with momentum are supported).
% ->paramatrix = a 1x4 matrix. 1st=epochs, 2nd=show, 3rd=learning
% rate and 4th=momentum term.
% ->sameWEIGHT= if not [] then weights are initialized using this matrix
%
% Algorithm:
% Standard neural network initialization
%
% ------------------/* Avraam Kasapis 2003*\------------------
%create min & max values Rx2 matrix for inputs!
mm = ones(inputsize,2);
mm = [mm(:,1).*mimax(1) mm(:,2).*mimax(2)];
%create the fully connected feed-forward network.
onet=newff(mm,[hneurons,4]);
%define Transfer function for the 2 layers
onet.layers{1}.transferFcn = fcnCELL{
...
...
... to be continued.
This is a preview. To get the complete source file,
please click here to download the whole source code package.