Invalid training data. Sequence responses must have the same sequence length as the corresponding predictors
10 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
ZEMIN HUANG
el 31 de En. de 2021
Respondida: Sindhu Karri
el 4 de Feb. de 2021
I have written a DNN model to train my dataset, however, im not too sure what to put for the inputsize. My training data and validation data is shown in the screenshot below. I got the error message when i put 112000 for inputsize of the DNN model. could someone advice me what the inputsize should be?
.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/505478/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/505478/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/505483/image.png)
clear variables;
close all;
% Load training data and essential parameters
load('trainData.mat','XTraindata','YTraindata','XValidatedata','YValidatedata');
numSC = 64;
% Batch size
miniBatchSize = 4000;
% Iteration
maxEpochs = 10;
% Sturcture
inputSize = 112000;
numHiddenUnits = 128;
numHiddenUnits2 = 64;
numHiddenUnits3 = numSC;
numClasses = 16;
% DNN Layers
layers = [ ...
sequenceInputLayer(inputSize,'Name','sequence')
fullyConnectedLayer(numHiddenUnits,'Name','fc1')
reluLayer('Name','relu1')
fullyConnectedLayer(numHiddenUnits2,'Name','fc2')
reluLayer('Name','relu2')
fullyConnectedLayer(numClasses,'Name','fc3')
softmaxLayer('Name','sm')
classificationLayer('Name','class')];
% Training options
options = trainingOptions('adam',...
'InitialLearnRate',0.01,...
'ExecutionEnvironment','auto', ...
'ValidationData',{XValidatedata,YValidatedata},...
'GradientThreshold',1, ...
'LearnRateDropFactor',0.1,...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize, ...
'Shuffle','every-epoch', ...
'Verbose',1,...
'Plots','training-progress');
% Train the neural network
tic;
net = trainNetwork(XTraindata,YTraindata,layers,options);
toc;
save('NN.mat','net');
0 comentarios
Respuesta aceptada
Sindhu Karri
el 4 de Feb. de 2021
Hii,
The input value to the 'sequenceInputLayer' should match 'numFeatures' in 'XTrain' data.
Change the code from:
sequenceInputLayer(112000,'Name','sequence')
to:
sequenceInputLayer(384,'Name','sequence')
will resolve the issue.
Refer to below attached link
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!