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!