필터 지우기
필터 지우기

How to fix error "Model parameter must be a string" in Run a Neural network sample Code

조회 수: 4 (최근 30일)
hello in this sample code this error " Model parameter must be a string" occurs when run section for plot regression graphs for 3 data type (train, validation,test)
codes :
data=xlsread('sarvak_normalized.xlsx'); % Input File
corrplot(data)
input=[1:9]; % Input Layer
p=data(:,input);
output=[10:11]; % Output Layer
t=data(:,output);
p=p'; t=t'; % Transposing Matrices
% t=log(t);
% Defining Validation Dataset
trainRatio1=.6;
valRatio1=.2;
testRatio1=.2;
%%Network Definition
nnn1=5; % First Number of Neurons in Hidden Layer
nnnj=5; % Jump in Number of Neurons in Hidden Layer
nnnf=100; % Last Number of Neurons in Hidden Layer
% net1.trainparam.lr=0.1;
% net1.trainParam.epochs=500;
% Training Network
it=20; % Max Number of Iteration
ii=0;
netopt{:}=1:nnnf;
for nnn=nnn1:nnnj:nnnf
ii=ii+1; nnn
net1=newff(p,t,[nnn nnn],{'purelin','purelin'},'traingd'); % For more functions see: 'Function Reference' in 'Neural Network Toolbox' of Matlab help
evalopt(ii)=1000;
for i=1:it
[net1,tr,y,et]=train(net1,p,t); % Training
net1.divideParam.trainRatio=trainRatio1;
net1.divideParam.valRatio=valRatio1;
net1.divideParam.testRatio=testRatio1;
estval=sim(net1,p(:,tr.valInd));
eval=mse(estval-t(:,tr.valInd));
if eval<evalopt(ii)
netopt{(ii)}=net1; tropt(ii)=tr; evalopt(ii)=eval;
end
end
end
plot(nnn1:nnnj:nnnf,evalopt)
%%Output
%clear
%load('run1');
nn=17
ptrain=p(:,tropt(nn).trainInd); ttrain=t(:,tropt(nn).trainInd); esttrain=sim(netopt{nn},ptrain);
ptest=p(:,tropt(nn).testInd); ttest=t(:,tropt(nn).testInd); esttest=sim(netopt{nn},ptest);
pval=p(:,tropt(nn).valInd); tval=t(:,tropt(nn).valInd); estval=sim(netopt{nn},pval);
estwhole=sim(netopt{nn},p);
% ttrain=exp(ttrain); ttest=exp(ttest); tval=exp(tval); t=exp(t);
% esttrain=exp(esttrain); esttest=exp(esttest); estval=exp(estval); estwhole=exp(estwhole);
plotregression(ttrain,esttrain,'Train',tval,estval,'Validation',...
ttest,esttest,'Test',t,estwhole,'Whole Data');
  댓글 수: 5
Rafik
Rafik 2020년 2월 22일
could you please help ? Thanks sayed hocein el hoceiny
Rafik
Rafik 2020년 2월 22일
Error is: error using corrplot (line 119)
the value of X is invalidv . observed data is empty.
error corrplot (data)

댓글을 달려면 로그인하십시오.

답변 (1개)

Rafik
Rafik 2017년 10월 16일
Please I need the full program could you please share It ? Thanks
  댓글 수: 3
Greg Heath
Greg Heath 2017년 11월 19일
ANOTHER COMMENT ERRONEOUSLY PLACED IN AN ANSWER BOX!
by Rafik on 16 Oct 2017
Please I need the full program could you please share It ? Thanks
THE RESPONSE BY SEYID (above)
hello I wrote full Program in this post. thank you...

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by