Invalid training data. Sequence responses must have the same sequence length as the corresponding predictors.

조회 수: 3 (최근 30일)
my data is n*1, I apply LSTM to analysis,,,,choose:
k =3; %滑动窗口设置为1 具体设多少需要衡量
for i = 1:size(dataTrainStandardized)-k+1
XTrain(:,i) = dataTrainStandardized(i:i+k-1,:); %将其分为101个序列,每个序列长度500,特征5个
YTrain(:,i)= dataTrainStandardized(i+k-1,:);
end
inputsize= 3;
outputsize = 1;
numHiddenUnits = 20;
layers = [sequenceInputLayer(inputsize)
lstmLayer(numHiddenUnits)
dropoutLayer(0.5)%防止过拟合
fullyConnectedLayer(outputsize)
regressionLayer];
options = trainingOptions('adam', ...
'MaxEpochs',500,...
'MiniBatchSize',16, ...
'GradientThreshold',1, ...%梯度下降阈值
'InitialLearnRate',0.005, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropPeriod',250, ...%
'LearnRateDropFactor',0.5, ...
'ValidationData',{XTrain,YTrain}, ...
'ValidationFrequency',1, ...
'Verbose',1, ...
'Plots','training-progress');
%% Train LSTM Network
[net tr] = trainNetwork(XTrain,YTrain,layers,options);
but error is Invalid training data. Sequence responses must have the same sequence length as the corresponding predictors.
look for help!!!!thank you

답변 (0개)

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!