how to construct a batch for multiple trajectories in neural network
이전 댓글 표시
If we have more than one trajectory and want to construct a batch for all these trajectories what will be the possible way to use all the trajectroies for the batch in neural network?
e.g this will work for multiple trajectories?
function [x0, targets] = createMiniBatch(numTimesteps,numTimesPerObs,miniBatchSize,X)
% e.g: numTimesteps=20;numTimesPerObs=5; miniBatchSize=10;
% Create batches of trajectories.
s = randperm(numTimesteps - numTimesPerObs, miniBatchSize);
x0 = dlarray(X(:, s));
targets = zeros([size(X,1) miniBatchSize numTimesPerObs]);
for i = 1:miniBatchSize
targets(:, i, 1:numTimesPerObs) = X(:, s(i) + 1:(s(i) + numTimesPerObs));
end
end
or there is another way for batch for multiple trajectroies
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Preprocess Data for Deep Neural Networks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!