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

6 views (last 30 days)
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);

Accepted Answer

Christopher McCausland
Christopher McCausland on 11 Feb 2021
Edited: Christopher McCausland on 11 Feb 2021
"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);
  6 Comments
long feifei
long feifei on 20 Sep 2024
I meet same problem. I have checked the arguments . It indeed don't add extra one.

Sign in to comment.

More Answers (0)

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!