Does "train" already include train/val/test division if a feedforward neural network or should I do it manually before?
조회 수: 6 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Greg Heath
2017년 9월 13일
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
Helper
2017년 9월 13일
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
Greg Heath
2017년 9월 14일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Sequence and Numeric Feature Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!