필터 지우기
필터 지우기

Too many input arguments.

조회 수: 37 (최근 30일)
Chandini Govind
Chandini Govind 2020년 1월 10일
편집: Kenan 2022년 6월 17일
clc;
close all;
clear all;
%load train dataset
train=xlsread('trainchanged.csv','A2:AG1000');
class_label=train(:,33);
%exclude eventid,weight from init_table
train_sample=train(:,2:31);
%appending class label
final_train=[train_sample class_label];
x=final_train(:,1:30);
xx=array2table(x);
yy=categorical(final_train(:,end));
%lstm definition
layers = [ ...
sequenceInputLayer(1)
bilstmLayer(100,'OutputMode','last')
fullyConnectedLayer(2)
softmaxLayer
classificationLayer
];
options = trainingOptions('adam', ...
'MaxEpochs',10, ...
'MiniBatchSize', 150, ...
'InitialLearnRate', 0.01, ...
'SequenceLength', 1000, ...
'GradientThreshold', 1, ...
'ExecutionEnvironment',"auto",...
'plots','training-progress', ...
'Verbose',false);
%train the network
net = trainNetwork(xx,yy,layers,options);
how to resolve the error: Too many input arguments.
  댓글 수: 5
Chandini Govind
Chandini Govind 2020년 1월 11일
2018b
Adam Danz
Adam Danz 2020년 1월 11일
"i know we can't run the code. i want know if it is due to some logical mistake."
@ Chandini Govind , I was able to identify the error because I happen to have r2018b on my laptop. Note that r2019b, the most recent release, does not have the same code for this function and we could not have identified the problem using the current release.
If you would have provided us with inputs, almost any experienced volunteer here could have instantly seen that your first input is a table while you're using numeric syntax. This is why it's almost always helpful to provide inputs that allow us to reproduce the problem.

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

채택된 답변

Adam Danz
Adam Danz 2020년 1월 11일
편집: Adam Danz 2020년 1월 11일
Understand the input options
In your version of Matlab (r2018b) as well as in the current release (r2019b), there are multiple syntax options for this function that allow for various input types:
Your code uses the numeric input syntax
net = trainNetwork(xx,yy,layers,options);
where xx and yy are expected to be numeric arrays.
What does your error tell us?
Your error in r2018b is thrown at line 274 in trainNetwork().
Error using trainNetwork>iParseInputArguments (line 274)
That line is within a conditional statement that indicates that your first input xx is actually a table. As you can see in the image below. If you look at the "table" syntax above, you'll see that it only has 3 inputs.
Solution
Use the right syntax for tables.
  댓글 수: 9
Chandini Govind
Chandini Govind 2020년 1월 14일
because i'm getting the following error and couldn't resolve it.
Error using trainNetwork (line 150)
Invalid training data. Predictors must be a N-by-1 cell array of sequences, where N is the number of sequences. All
sequences must have the same feature dimension and at least one time step.
Error in study8 (line 37)
net = trainNetwork(ft,yy,layers,options);
Kenan
Kenan 2022년 6월 17일
편집: Kenan 2022년 6월 17일
For information there is an example for this method :

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by