could anyone help me how to feed the validation data into the options in deep neural network.
조회 수: 43 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
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);
You can have a look at the full example here: https://www.mathworks.com/help/deeplearning/ref/trainingoptions.html#bvniuj4
I hope this answers your question.
댓글 수: 2
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!