Error Using trainNetwork (line 170). Too many input arguments.
7 次查看(过去 30 天)
显示 更早的评论
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);
0 个评论
采纳的回答
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);
6 个评论
long feifei
2024-9-20,14:52
I meet same problem. I have checked the arguments . It indeed don't add extra one.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Build Deep Neural Networks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!