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

1 回表示 (過去 30 日間)
seyed hosein alhoseiny
seyed hosein alhoseiny 2017 年 9 月 1 日
コメント済み: Rafik 2020 年 2 月 22 日
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...
Rafik
Rafik 2020 年 2 月 22 日
Thank you very much

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by