MATLAB Answers

Error Using trainNetwork (line 170). Too many input arguments.

14 ビュー (過去 30 日間)
syed
syed 2021 年 2 月 11 日
コメント済み: syed 2021 年 2 月 17 日
Where did i go wrong? Please help me with the code.
I have a table of 500x31 (features as columns =30 and class lable column 31 ). Feature values are in rows for 5 class (100 rows for each class).
dataset sample is shown below. when i run the code i am getting error
"Error using trainNetwork (line 170)
Too many input arguments.
Error in calling1 (line 30)
net = trainNetwork(dataTrain,YTrain,layers_1,options);
Caused by:
Error using trainNetwork>iParseInputArguments (line 326)
Too many input arguments."
%Spliting the data set into 80:20
cvp=cvpartition(coif2level3.class,'holdout',0.2);
dataTrain=coif2level3(training(cvp),:);
dataValidation=coif2level3(test(cvp),:);
XTrain=dataTrain(:,1:30);
YTrain=dataTrain.class;
YValidation=dataValidation.class;
%XTrain size 400x30
%YTrain size 400X1
%workspace
% Defining LSTM Architecture
numFeatures = 30;
numHiddenUnits = 100;
numClasses = 5;
layers_1= [ ...
sequenceInputLayer(numFeatures)
lstmLayer(numHiddenUnits,'OutputMode','last')
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer];
miniBatchSize = 27;
maxEpochs = 100;
options = trainingOptions('adam', ...
'ExecutionEnvironment','cpu', ...
'MaxEpochs', ...
'MiniBatchSize',miniBatchSize, ...
'GradientThreshold',2, ...
'Shuffle','every-epoch', ...
'Verbose',false, ...
'Plots','training-progress');
net = trainNetwork(dataTrain,YTrain,layers_1,options);

採用された回答

Christopher McCausland
Christopher McCausland 2021 年 2 月 11 日
編集済み: Christopher McCausland 2021 年 2 月 11 日
"Too many input arguments" is a sign that the function expects fewer input arguments. In this case your input arguments appear to be=> dataTrain,YTrain,layers_1,options.
Are only the arguments included in your function call? I think you may have included an extra one, or more.
[Returned_Argument] = myfunc(dataTrain,YTrain,layers_1,options);
  5 件のコメント
syed
syed 2021 年 2 月 17 日
thank you

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

その他の回答 (0 件)

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by