フィルターのクリア

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 Center および File ExchangeImage Data Workflows についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by