A DIFFICULT NEURAL NETWORK
Show older comments
i need help on how to design the followin network, i ll appreciate some code since i am raelly new on both NN and matlab thanx in advance
0)i got 50 4x1 matrices that i wanna target to 1 and 0 (50 data)
1) i use 35 to train the network 15* to test
2)i take these 35 data and split them into 7 folds of 5 data each, lets say:
i=1,..,n=7 from that 7 fold i pick a random fold to test/validate and keep the rest to train the network and i do this 7 times for each fold
3) so now i have created 8 networks: the original and onother 7 due to the data partition i made
Accepted Answer
More Answers (7)
Greg Heath
on 29 Apr 2013
Performance estimates from training and validation subsets are biased, especially from small data subsets. Try to use subsets with at least 10 data points.
You may not have enough data to obtain reliable results with a validation set.
1. Try 5-fold cross-validation with 4 training subsets and 1 test subset.
2. Try to use the smallest number of hidden nodes that will yield reasonable results.
2. Omit the validation set (trn/val/tst/ = 4/0/1) but either use
a. msereg
b. The regularization option of mse
or
c. trainbr
3. Obtain and store the average and standard deviations of MSEtrn and MSEtst
4. Randomize the data and repeat this procedure M times until the updated mean and standard deviation of the 5*M estimates stabilize.
If you feel that you must use validation stopping, repeat the above with a 3/1/1 split with and/or without regularization.
Hope this helps.
Thank you for formally accepting my answer
Greg
1 Comment
laplace laplace
on 30 Apr 2013
Greg Heath
on 10 May 2013
A DIFFICULT NEURAL NETWORK
Asked by laplace laplace on 28 Apr 2013 at 15:50
Latest activity by laplace laplace on 9 May 2013 about 3:00
%1st step: i wanna train a NN with the patternet algorith, data and targets not shown here!
hiddenLayerSize = 1;
1. Why H =1?
net = patternnet(hiddenLayerSize);
% net.divideParam.trainRatio = 70/100;
% net.divideParam.valRatio = 15/100;
% net.divideParam.testRatio = 15/100;
2. Why specify default division ratios?
3. Why accept the default 'dividerand'?
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)
4.Why isn't tr used to find separate trn/val/tst indices and performance results?
% View the Network
view(net)
%2nd step ****at this point i want to use the trainning set of step 1 and
apply to it 5-fold cross validation
5. WHY? This makes no sense.
%the problem here is: 1) how to imply that i use the trainning set of step1
%and 2) : mistakes in code
Indices = crossvalind('Kfold',inputs , 5);
6. WHERE IS THIS FUNCTION?
for i=1:5
test = (Indices == i);
train = ~test;
for i = 1:5 %
7. Cannot use i for both loops. Do you mean n?
8. You are not using the k-fold data division to get different data for different loops
net = patternnet(inputs,targets,h); %test train
net.divideFcn = 'dividetrain';
9. This forces all data to be in the training set ??
net.trainParam.goal = MSEgoal;
net.trainParam.min_grad = MinGrad;
[net,tr] = train(net,inputs,targets); % test train
bestepoch = tr.best_epoch;
R2(n,h) = 1 - tr.perf(bestepoch)/MSEtrn00;
end
10. Missing another end
1 Comment
laplace laplace
on 22 May 2013
laplace laplace
on 7 May 2013
Edited: laplace laplace
on 7 May 2013
1 Comment
Greg Heath
on 8 May 2013
I have no idea what you are trying to do. There are too many mistakes and no comments.
Please review, revise, insert comments and repost.
laplace laplace
on 9 May 2013
laplace laplace
on 12 May 2013
0 votes
laplace laplace
on 14 May 2013
0 votes
laplace laplace
on 22 May 2013
0 votes
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!