Managing different lengths in time series for sequence-to-sequence classification.
조회 수: 5 (최근 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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!