问题描述:

I have made a function "neuralnetfunc" which takes cell array input and target to make a neural network. This is a multilayer perceptron.

I have used data division function. Unfortunately, I can not view the testing and validation performance plots in matlab.

Please help me to find a way to view the validation and test performence .

Thanks,

Hirak

yy(1:90)=1;

X=mat2cell(FeatureSpec,[1 1 1 1 1 1 1],yy);

T=mat2cell(tgt,[1],yy);

[ysim,net]=neuralnetfunc(X,tgt);

function[Y,net]=neuralnetfunc(X,T)

net= network;

% number of inputs in the input layer

net.numInputs = 7;

net.numLayers = 10;

% Bias are connected to every neural net

net.biasConnect=[1; 1; 1; 1; 1;1 ; 1; 1 ; 1; 1];

% How inputs are connected

net.inputConnect(1,1) = 1;

net.inputConnect(2,2) = 1;

net.inputConnect(3,3) = 1;

net.inputConnect(4,4) = 1;

net.inputConnect(5,5) = 1;

net.inputConnect(6,6) = 1;

net.inputConnect(7,7) = 1;

% How layers are connected

net.layerConnect(8,1)=1;

net.layerConnect(8,2)=1;

net.layerConnect(8,3)=1;

net.layerConnect(9,4)=1;

net.layerConnect(9,5)=1;

net.layerConnect(9,6)=1;

net.layerConnect(9,7)=1;

net.layerConnect(10,8)=1;

net.layerConnect(10,9)=1;

net.outputConnect = [0 0 0 0 0 0 0 0 0 1];

net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};

net.layers{1}.size = 1;

net.layers{1}.transferFcn = 'logsig';

net.layers{1}.initFcn = 'initnw';

net.layers{2}.size = 1;

net.layers{2}.transferFcn = 'logsig';

net.layers{2}.initFcn = 'initnw';

net.layers{3}.size = 1;

net.layers{3}.transferFcn = 'logsig';

net.layers{3}.initFcn = 'initnw';

net.layers{4}.size = 1;

net.layers{4}.transferFcn = 'logsig';

net.layers{4}.initFcn = 'initnw';

net.layers{5}.size = 1;

net.layers{5}.transferFcn = 'logsig';

net.layers{5}.initFcn = 'initnw';

net.layers{6}.size = 1;

net.layers{6}.transferFcn = 'logsig';

net.layers{6}.initFcn = 'initnw';

net.layers{7}.size = 1;

net.layers{7}.transferFcn = 'logsig';

net.layers{7}.initFcn = 'initnw';

net.layers{8}.size = 4;

net.layers{8}.transferFcn = 'logsig';

net.layers{8}.initFcn = 'initnw';

net.layers{9}.size = 4;

net.layers{9}.transferFcn = 'logsig';

net.layers{9}.initFcn = 'initnw';

net.layers{10}.size = 1;

net.layers{10}.transferFcn = 'logsig';

net.layers{10}.initFcn = 'initnw' ;

net.initFcn = 'initlay';

net.divideFcn = 'dividerand';

net.divideMode = 'sample';

net.divideParam.trainRatio = 0.8;

net.divideParam.valRatio = 0.1;

net.divideParam.testRatio = 0.1;

net.performFcn = 'mse';

net.trainFcn = 'trainlm';

net.trainParam.epochs=5000;

net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...

'plotregression', 'plotfit'};

net = train(net,X,T);

Y = sim(net,X);

end

相关阅读:
Top