Neural Network options Output net work, 'best-validation-loss'

5 vues (au cours des 30 derniers jours)
Miao Yang
Miao Yang le 28 Oct 2021
I use simple feed forward neural network only 2 layers with miniBatchSize, and inside the neural network options, I use adam for solver option, and 'OutputNetwork' is 'best-validation-loss'. But the error message says outputNetwork is not an option for solver Adam. Then I tried sgdm, and rsprop, the rest of 2 options Matlab offered for solver. The error message still there and says outputnetwork is not an option fo solver sgdm, and rsprop respectively. I wonder how to set outputnetwork to be best-validation-loss since it fails under all solver options ?
  3 commentaires
Miao
Miao le 28 Oct 2021
%TTr is training table, reponse variable is last column named exRet.
numFeatures = size(TTr,2)-1; % all numeric data, no categorical.
layers = [
featureInputLayer(numFeatures)
fullyConnectedLayer(32)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(16)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(1)
regressionLayer
];
miniBatchSize = 100;
num = height(TTr)/miniBatchSize; % total training observation/batch size = number of batch
options = trainingOptions('adam',...
'MiniBatchSize',miniBatchSize,...
'InitialLearnRate',0.001,...
'ValidationData',TVa,...
'ValidationPatience',5,...
'ValidationFrequency',round(num),...
'OutputNetwork','best-validation-loss',...
'Shuffle','every-epoch',...
'MaxEpochs',500,...
'L2Regularization',0.001,...
'Plots','training-progress', ...
'Verbose',false);
net = trainNetwork(TTr,'exRet',layers,options);
When I run the code above, error message is below, the version my matlab is 2021a, should I update to 2021b then maybe it work ok?
Error using nnet.cnn.TrainingOptionsADAM (line 132)
'OutputNetwork' is not an option for solver 'adam'.
Error in trainingOptions (line 317)
opts = nnet.cnn.TrainingOptionsADAM(varargin{:});
Error in tryneural (line 25)
options = trainingOptions('adam',...
Taylor Chu
Taylor Chu le 9 Nov 2021
I'm getting the same error but only when I'm running it on cluster which I assume is running linux. I've tried running the same script (my script) on windows and it runs fine with the 'OutputNetwork', 'best-validation-loss' training option. Removing that option works on cluster but it does not really solve the problem

Connectez-vous pour commenter.

Réponses (1)

Niccolò Dal Santo
Niccolò Dal Santo le 10 Nov 2021
Hi Miao,
The 'OutputNetwork', 'best-validation-loss' training option is available in R2021b or later versions. Which MATLAB version are you using? You can obtain the version with the following command:
>> version
ans =
'9.11.0.1751886 (R2021b)'
Cheers,
Niccolò

Catégories

En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by