how can i train my network for test and validation data?

1 view (last 30 days)
x is the my input, y is the desired output then I split x as validation and test data y as well. How should be my algorithm? I want to see how weights are changing for each epoch.
x=[5,1,1,1,2,1,3,1,1;5,4,4,5,7,10,3,2,1;3,1,1,1,2,2,3,1,1;6,8,8,1,3,4,3,7,1;4,1,1,3,2,1,3,1,1;8,10,10,8,7,10,9,7,1;1,1,1,1,2,10,3,1,1;2,1,2,1,2,1,3,1,1;2,1,1,1,2,1,1,1,5;4,2,1,1,2,1,2,1,1;1,1,1,1,1,1,3,1,1;2,1,1,1,2,1,2,1,1;5,3,3,3,2,3,4,4,1;1,1,1,1,2,3,3,1,1;8,7,5,10,7,9,5,5,4;7,4,6,4,6,1,4,3,1;4,1,1,1,2,1,2,1,1;4,1,1,1,2,1,3,1,1;10,7,7,6,4,10,4,1,2;6,1,1,1,2,1,3,1,1;7,3,2,10,5,10,5,4,4;10,5,5,3,6,7,7,10,1;3,1,1,1,2,1,2,1,1;5,10,10,8,5,5,7,10,1;1,1,1,1,2,1,3,1,1;5,2,3,4,2,7,3,6,1;3,2,1,1,1,1,2,1,1;5,1,1,1,2,1,2,1,1;2,1,1,1,2,1,2,1,1;1,1,3,1,2,1,1,1,1];
y=[2;2;2;2;2;4;2;2;2;2;2;2;4;4;4;2;2;4;2;4;4;2;4;2;4;2;2;2;2]
x_test=x(1:20,:)
x_validation=x(21:end,:)
y_test=y(1:20,:)
y_validation=y(21:end,:)

Answers (2)

Greg Heath
Greg Heath on 16 Jan 2019
Where is your training data?
The MATLAB default is a random choice of trn/val/tst = 0.7/0.15/0.15
I choose candidate values of H to avoid overfitting and, 10-to-20 random initial sets of weights.
There are zillions of my examples in BOTH COMP.SOFT-SYS.MATLAB & ANSWERS
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 Comment
Ahsen Feyza Dogan
Ahsen Feyza Dogan on 16 Jan 2019
Actually I am new at this field so I confused that I am on the right way. I am trying to do split my data set x into test and validation then using single and multilayer perceptron get output as 2 or 4 depends on my input. Could you briefly explain what am I suppose to do?
Thanks

Sign in to comment.


Greg Heath
Greg Heath on 16 Jan 2019
The MATLAB default AUTOMATICALLY splits the data into TRAINING + VALIDATION+TEST SUBSETS in the ratios
0.7/0.15/0.15.
For regression and curvefitting see the documentation and examples using the commands
help fitnet
and
doc fitnet
For classification and pattern recognition use
help patternnet
and
doc patternnet
For examples just add "greg" to the commands.
Hope this helps
Greg

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!