could anyone help me how to feed the validation data into the options in deep neural network.

6 ビュー (過去 30 日間)
jaah navi
jaah navi 2021 年 6 月 27 日
コメント済み: Katja Mogalle 2021 年 7 月 1 日
I have done the matlab code written by myself instead of using tool box to train and test the model.
For training i am using net = trainNetwork(XTrain,YTrain,layers,options)
for options i am using training options ADAM which has in-built
options.ValidationData []
options.ValidationFrequency 50
options.ValidationPatience, 5
Now I want to include my (XVal, YVal) into it.
So I think the model can perform both training and validation if I am not mistaken.
Or else please help me how to feed (XVal, YVal) into the model.

回答 (1 件)

Katja Mogalle
Katja Mogalle 2021 年 6 月 30 日
In order to perform validation periodically during training using trainNetwork, you can specify the validation data in the trainingOptions command that is used to generate training options.
Roughly, it could look as follows:
options = trainingOptions('adam', ...
'ValidationData',{XVal, YVal}, ...
'ValidationFrequency',30, ...
'Plots','training-progress');
net = trainNetwork(XTrain,YTrain,layers,options);
I hope this answers your question.
  2 件のコメント
Katja Mogalle
Katja Mogalle 2021 年 7 月 1 日
Validation of LSTM Networks during training was enabled in MATLAB R20018b. I suspect you have an older version of MATLAB?
So one option would be to upgrade to a newer version of MATLAB. Deep learning is a very active area at MathWorks so you'll see a lot of new capabilities added in every release. The newest release at the moment is R2021a.
To be able to better help you I'd need to know how your data is structured and what task you are trying to solve.
If I'd have to guess ... I've noticed that you aren't using any LSTM layers. Perhaps you have neither image data nor data with a time dimension? Starting in R2020b, there is a featureInputLayer that can better deal with tabular-style data. If you do want to stay in the older MATLAB release, you could try the workaround mentioned here: https://www.mathworks.com/matlabcentral/answers/395817-can-i-use-trainnetwork-to-train-deep-neural-networks-with-non-image-or-non-sequence-data-for-regre . The idea is to use an imageInputLayer and reshape your data to be in the format 1-by-1-by-NumFeatures-by-NumObservations. Networks with imageInputLayers (instead of sequenceInputLayers) support validation during training already since R2017b.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by