Correct format for 'ValidationData' ?
Show older comments
I am currently running a neural Network and want to use a section of the data to validate the network.
I use "net = trainNetwork(NNdata,NNans,layers,options); " to train the network.
layers = [ sequenceInputLayer ... ... fullyConnectedLayer, softmaxLayer, classificationLayer];
NNdata is a 500 by 10.000 double Matrix representing training exmaples. NNans is a 1 by 10.000 categorical (1 or 0)
I also have valNNdata ( 500 by 2000 matrix) and valNNans ( 1 by 2000 categorical).
I tried the following two ways to input the validation data in the "options" for the machine learning code.
'ValidationData',{valNNdata,valNNans}
this gave me the error
'Error in A090318NeuralNWSliding (line 147) net = trainNetwork(NNdata,NNans,layers,options);
Caused by: Error using nnet.internal.cnn.FourDArrayMiniBatchDatasource (line 41) Number of observations in X and Y disagree.'
I also tried:
'ValidationData',table(valNNdata',valNNans')
which gave me another error
Error in A090318NeuralNWSliding (line 147) net = trainNetwork(NNdata,NNans,layers,options);
Caused by: Error using nnet.internal.cnn.util.TrainNetworkDataValidator/assertValidClassificationTable (line 146) Invalid validation data table for classification. Predictors must be in the first column of the table, as image paths or images. Responses must be after the first column, as categorical labels.
What is the correct way to input part of my data as validation data?
1 Comment
Robert Jansen
on 26 Mar 2021
I have this same question. Did you ever figure it out?
Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!