Does "train" already include train/val/test division if a feedforward neural network or should I do it manually before?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello everyone! I have the following script:
-----------------------
inputs=training_set'; %training_set is my matrix of features, with observation on rows and features on columns
net = feedforwardnet(10); %I set 10 hidden layers and by default trains with "trainlm" function
[net,tr] = train(net,inputs,new_training_labels');
y_predict=net(inputs);
----------------------
My question is: does train already divide "inputs" in train/val/test and runs the crossvalidation automatically or should I do it before and then write something like:
y_predict=net(inputs(trainInd,:));
Thank you for your time!
0 commentaires
Réponses (2)
Greg Heath
le 13 Sep 2017
1. Use fitnet for regression and patternnet for classification.
2. Use the help and doc commands for sample code.
3. Run the sample code. If you have problems, here we are!
4. Adjust your code until you are satisfied.
5. Try your data with the code
etc
[ net tr y e ] = train( net, x, t );
% y = net(x); e = t-y;
NMSE = mse(e)/mse(t-mean(t,2)) % NORMALIZED MSE
All of the datadivision details are in the training record tr
To watch all of the goodies tumble out just type
tr = tr
Hope this helps.
Thank you for formally accepting my answer
Greg
0 commentaires
Helper
le 13 Sep 2017
Yes, it already includes train, validation, and test.
The default training function of “feedforwardnet” is “trainlm”. If you check the documentation of “ trainlm ”.
You will find “trainlm supports training with validation and test vectors if the network's NET.divideFcn property is set to a data division function.” Then if you check the “divideFcn” of “net” in your case, it would be “dividerand” (in MATLAB R2017a).
For more information of “dividerand”, please type “help nndivision”, then you would get a more detailed explanation.
1 commentaire
Greg Heath
le 14 Sep 2017
For more information on any entity FIRST use the help and doc commands (in that order!). The recent versions of the doc commands are not as helpful as the older versions.
help dividerand
doc dividerand
Hope this helps
Greg
Voir également
Catégories
En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!