Custom performance vectors for neural network training
Show older comments
I'm working on pattern recognition using MATLAB's built in neural network toolbox. I've used this toolbox to generate code. I've successfully implemented this in a working gui. The problem that I am trying to solve now is to let the user select vectors for validation and testing from a file. For example, I'm training the network to recognize 4 letters "ABCD". I've been reading in documentation that validation samples are used to measure network generalization; i.e found out how my network would perform on data it has never seen before. There's also testing samples which are used to give an independent measure of network performance during and after training; used to determing when to stop training.
I would still like to use these. A work around to this is to combine my training, validation, and testing vectors into one matrix. I then use this as my training matrix and use the code below to separate the vectors back out. Train, Val, and Test can be determined by using size() for each vector (the original training vector, validation, and testing). The matrix data contains the original training vector, validation vector, and testing vector column-wise.
% Setup Division of Data for Training, Validation, Testing
% For a list of all data division functions type: help nndivide
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = Train/size(data,2);
net.divideParam.valRatio = Val/size(data,2);
net.divideParam.testRatio = Test/size(data,2);
The one problem that I see with this is decimal ratios. For example, let the size of the original training vector, the validation vector, and the testing vector all be 10x1 (the rows contain the numbers for the network, the columns are the number of sample sets). This would mean that the trainRatio, valRatio, and testRatio would all be 3.333333333333333e-01. I'm not sure if MATLAB will split data up into three parts without throwing an error because of the decimal.
Any thoughts on this or work arounds?
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!