MLP using the Deep Learning Toolbox; Iteration per epoch is 1 in every epoch.
17 views (last 30 days)
Show older comments
Ritu Panda
on 21 Sep 2020
Commented: Joachim Greck
on 12 Mar 2021
I am training a MultiLayer Perceptron using the Deep Learning Toolbox. I have specified the size of Mini Batch training. However, while training on every epoch, the model trains through the entire dataset once and does not iterate over the different batches of data.
This is the code.
% Network Architure
networkLayers = [sequenceInputLayer(1122,'Name','Input')
fullyConnectedLayer(750,'Name','Hidden')
reluLayer('Name','ReLU-Activation1')
dropoutLayer(0.4,'Name','dropout_Regularization')
fullyConnectedLayer(1,'Name','Output')
reluLayer('Name','ReLU-Activation2')
regressionLayer('Name','RegressionOutput')];
% Parameter setting
XValidation = features(:, 80:99);
YValidation = target(:, 80:99);
maxEpochs = 60;
miniBatchSize = 20;
validationFrequency = floor(numel(target)/miniBatchSize);
options = trainingOptions('adam', ...
'MaxEpochs',maxEpochs, ...
'MiniBatchSize',miniBatchSize, ...
'InitialLearnRate',0.01, ...
'GradientThreshold',1, ...
'Shuffle','never', ...
'Plots','training-progress',...
'Verbose',0);
net=trainNetwork(features,target,networkLayers,options);
0 Comments
Accepted Answer
Nomit Jangid
on 24 Sep 2020
Hi Ritu,
If your input data is in a M x N matrix format (where, M = number of parameters and N = number of observations ) MATLAB assumes that this is a single observation problem with M time-series each being N points long. For each epoch, we have only 1 iteration and so the mini-batch size option is ignored because it doesn't apply to just 1 observation.
If you'd like to break the time-series into smaller chuncks of data that are treated as different observations, you can do that using the sequenceLength parameter in trainingOptions, by providing a positive integer with the desired sequence length:
I hope this helps.
2 Comments
Joachim Greck
on 12 Mar 2021
Hello,
I have encountered the same issue and modifying the Sequence Length did solve the problem. Nevertheless, do you know a way to pre-condition my training data in a way that Matlab will automatically see it as a multiple observation problem ?
Thank you for your help,
Regards
More Answers (0)
See Also
Categories
Find more on Define Shallow Neural Network Architectures in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!