LSTM forecasting time series

조회 수: 7 (최근 30일)
diana haron
diana haron 2020년 9월 27일
댓글: ghada alabaidy 2021년 5월 28일
Hi,
I'm currently learning how to use LSTM using the chicken pox example,
The data in this example is just 1 row with multiple columns. Does anyone know how I can use it with more data sets (multple row and mutiple columns).
It would be appreciate to provide the example or explanation about it.
Thank you
  댓글 수: 1
ghada alabaidy
ghada alabaidy 2021년 5월 28일
Excuse me, can I know how the test is calculated? I collected data from the accelerometer with a smartphone and I want it to work in LSTM Can you help me with many thanks

댓글을 달려면 로그인하십시오.

답변 (1개)

Srivardhan Gadila
Srivardhan Gadila 2020년 10월 1일
Refer to the documentation of trainNetwork to understand what should be the input and target data format & shape.
Also the following code might help you:
inputSize = [13 11 1];
nTrainSamples = 50;
filterSize = 5;
numFilters = 20;
numHiddenUnits = 200;
numResponses = 5;
layers = [ ...
sequenceInputLayer(inputSize,'Name','input')
flattenLayer('Name','flatten')
lstmLayer(numHiddenUnits,'Name','lstm','OutputMode','sequence')
fullyConnectedLayer(numResponses, 'Name','fc')
regressionLayer('Name','regression')];
lgraph = layerGraph(layers);
analyzeNetwork(layers)
%%
trainData = arrayfun(@(x)rand([inputSize(:)' 1]),1:nTrainSamples,'UniformOutput',false)';
trainLabels = arrayfun(@(x)rand(numResponses,1),1:nTrainSamples,'UniformOutput',false)';
size(trainData)
size(trainLabels)
%%
options = trainingOptions('adam', ...
'InitialLearnRate',0.005, ...
'LearnRateSchedule','piecewise',...
'MaxEpochs',300, ...
'MiniBatchSize',1024, ...
'Verbose',1, ...
'Plots','training-progress');
net = trainNetwork(trainData,trainLabels,lgraph,options);

카테고리

Help CenterFile Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by