How to fix LSTM Model that returns value for epoch size during training different from that in code.

3 次查看(过去 30 天)
I have this LSTM model constructed for time series analysis. with parameters as such
numFeatures = 6
numHiddenLayers = 100
numResponse = 1
Layers = [...
sequenceInputLayer(numfeatures);...
lstmLayer(numHiddenLayer, "OutputMode", "last")
fullyConnectedLayer(numResponses)
reluLayer
regressionLayer
];
miniBatchSize = 24
Epoch = 50
options = trainingOptions("adam",...
"ExecutionEnvironment", "auto",...
"MaxEpoch", Epoch, ...
"MiniBatchSize", miniBatchSize,...
"Plots","training-progress");
Now during trainig the Epoch size is kept constant at 30, even though I set it to 50 in code. please how can I fix this and what is the cause?

回答(1 个)

Ashutosh
Ashutosh 2023-5-25
编辑:Ashutosh 2023-5-25
Hi,
I am assuming that you are using the R2023a distribution of MATLAB. In that case, your method of assigning name-value arguments ("MaxEpoch", Epoch,"MiniBatchSize", miniBatchSize etc) may not be valid, instead you may have to use Name=Value format. Refer to the MATLAB Documentation for trainingOptions, more specifically the section for Name-Value Arguments. Note that the comma method is used for pre-R2021a as mentioned. Note also, that the default value for epochs is 30 which is being assigned in your case. It should work as intended if you give the options as below:
options = trainingOptions("adam",...
ExecutionEnvironment = "auto",...
MaxEpochs = Epoch, ...
MiniBatchSize = miniBatchSize,...
Plots = "training-progress");
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by