Invalid training data. Sequence responses must have the same sequence length as the corresponding predictors
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ZEMIN HUANG
am 31 Jan. 2021
Beantwortet: Sindhu Karri
am 4 Feb. 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?
.
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 Kommentare
Akzeptierte Antwort
Sindhu Karri
am 4 Feb. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!