how to construct a batch for multiple trajectories in neural network
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!