could anyone help me how to feed the validation data into the options in deep neural network.
43 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Katja Mogalle
el 30 de Jun. de 2021
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 comentarios
Katja Mogalle
el 1 de Jul. de 2021
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.
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!