how exactly to use the trainNetwork function?

4 visualizzazioni (ultimi 30 giorni)
I want to use the function net = trainNetwork(sequences,layers,options) like this to train a recurrent network of the form lstm for identifying nonlinear systems. I have for training two sets of input data and one set of output data.
numResponses=1;
featureDimension=1;
numHiddenUnits=70;
miniBatchSize=300;
maxEpochs=1000;
layer=[...
sequenceInputLayer(featureDimension)
lstmLayer(numHiddenUnits,'OutputMode','last')
dropoutLayer(0.02)
fullyConnectedLayer(numResponses)
regressionLayer
];
options=trainingOptions('adam',...
'MaxEpochs',maxEpochs,...
'MiniBatchSize',miniBatchSize,...
'GradientThreshold',20,...
'Shuffle','once', ...
'Plots','training-progress',...
'ExecutionEnvironment','parallel',...
'LearnRateSchedule','piecewise',...
'LearnRateDropPeriod',200,...
'L2Regularization',1e-3,...
'LearnRateDropFactor',0.5,...
'Verbose',0,...
'Plots','training-progress');
C = num2cell(table2array(x1_train));
net = trainNetwork(C',layer,options);
Here is a part of my code.x1_train is a variable that contains the u1 regressor for the 2 tank system and I transformed it into a cell array because I understood that I had to do so that I could use this data in the train network function and I got the following error:
Error using trainNetwork
Not enough input arguments.
Error in sperproiectfinal1 (line 84)
net = trainNetwork(C',layer,options);
Caused by:
Error using nnet.internal.cnn.trainNetwork.DLTInputParser>iParseInputArguments
Not enough input arguments.
please help me with some steps that I should follow to use the function properly and be able to train my network with two sets of input data and one set of output data

Risposta accettata

Cris LaPierre
Cris LaPierre il 4 Dic 2023
You need to include a response input.
From the documentation for sequence (Numeric or cell array row of the table) :
  • If you specify sequences as a numeric or cell array, then you must also specify the responses argument.
  2 Commenti
David Vatavu
David Vatavu il 5 Dic 2023
Hi Cris, thanks for your reply. But my question is: how do I find out variabla responses?
Cris LaPierre
Cris LaPierre il 5 Dic 2023
It should be part of your training data set. You need to create a 'labeled' data set for training.
When the input data is a numeric array or a cell array, specify the responses as one of the following.
  • categorical vector of labels
  • numeric array of numeric responses
  • cell array of categorical or numeric sequences

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Deep Learning Toolbox in Help Center e File Exchange

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by