필터 지우기
필터 지우기

Managing different lengths in time series for sequence-to-sequence classification.

조회 수: 3 (최근 30일)
Hello,
I would like to ask a general opinion regarding the example displayed in:
In order to manage different lengths in a mini-batch of training data the example implement a left zero padding adding vectors of zero at the left of both accelerometric data and relative responses.
In this way the resulting sequences are:
Subsequently in the evaluation of the training loss the function:
function loss = maskedCrossEntropyLoss(dlY, dlT, numTimeSteps)
numObservations = size(dlY,2);
loss = dlarray(zeros(1,numObservations,'like',dlY));
for i = 1:numObservations
idx = 1:numTimeSteps(i);
loss(i) = crossentropy(dlY(:,i,idx),dlT(:,i,idx),'DataFormat','CBT');
end
end
Evaluate the loss on the first idx samples of the padded sequences where idx represent the real (not padded) number of time samples of the data. However since idx goes to 1:numTimeSteps just the first time samples are considered, from left to right includind the padded samples of zeros. I would, instead, evaluate the last samples:
idx = size(dlY,3)-numTimeSteps(i)+1:size(dlY,3);
loss(i) = crossentropy(dlY(:,i,idx),dlT(:,i,idx),'DataFormat','CBT');
Is this a correct consideration or i am losing something?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by