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

11 visualizaciones (últimos 30 días)
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?

Respuestas (0)

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by