How can use (if, end) inside the neural network script?
이전 댓글 표시
I have a script for neural network for 4 inputs and 1 target data (each one 104 times observation). when I run the network, the variety of performance in different runs are to much and it is sometime more and leas than 3, where my ideal performance is leas than 3. In order to solve this problem, I want to use a (if, then) inside the script. Although, I do not know this is applicable or not, but the network would not goes inside the loop. I would really appreciate to tell me how can I use (if, end) statement inside the script.
inputs = x;
targets = t;
[ I, N ]= size(x);
performance=10;
if performance>3
% Create a Fitting Network
H = 10;
TF={'tansig','purelin'};
net = newff(x,t,H,TF);
net = init(net);
net = train(net,x,t);
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.trainparam.max_fail=10;
% Train the Network
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs);
end
W = outputs / [ ones(1,N) ; x ];
y = W*[ ones(1,N) ;x ];
view(net)
채택된 답변
추가 답변 (1개)
Walter Roberson
2015년 8월 13일
0 개 추천
newff() is officially obsolete, and the documentation has been removed from current releases. You should try to convert it to more modern routines. See http://www.mathworks.com/matlabcentral/answers/77741-newff-create-a-feed-forward-backpropagation-network-obsoleted-in-r2010b-nnet-7-0
You will probably want to train multiple times on different random subsets. I do not know what the best way of doing that is.
카테고리
도움말 센터 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!