Neural Network : Poor Result

4 views (last 30 days)
Ashikur
Ashikur on 29 Jan 2012
Hello,
I was trying to simulate MATLAB's NN functions before testing my network. I was training y = x1+x2.
But see how it performed,
>> net = newfit([1 2 3 4 5 0 1 2 5;1 2 3 4 5 1 1 1 1],[2 4 6 8 10
0 2 3 6],15);
>> net = train(net,[1 2 3 4 5 0 1 2 5;1 2 3 4 5 1 1 1 1],[2 4 6 8
10 0 2 3 6]);
>> sim(net,[1;4])
ans =
12.1028
>> sim(net,[4;4])
ans =
8.0000
>> sim(net,[4;1])
ans =
3.0397
>> sim(net,[2;2])
ans =
5.1659
>> sim(net,[3;3])
ans =
10.3024
Can anyone explain what is wrong with these training data? Is it not enough to estimate y = x1+x2 ? Or it just over-specialized?

Accepted Answer

Greg Heath
Greg Heath on 31 Jan 2012
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PTRN = [1 2 3 4 5 0 1 2 5; 1 2 3 4 5 1 1 1 1]
TTRN = [2 4 6 8 10 0 2 3 6]
PTST = [ 1 4 4 2 3 ; 4 4 1 2 3 ]
[ I NTRN ] = SIZE(PTRN) % [ 2 9 ] [ O NTRN ] = SIZE(TTRN) % [ 1 9 ]
DID YOU MAKE A CONTOUR PLOT OF TTRN VS PTRN?
DID YOU OVERLAY THE POINTS OF PTST ON THE CONTOUR PLOT?
NEQ = NTRN*O % 9 NW = (I+1)*H+(H+1)*O % 30 + 11 = 41
YOU HAVE ONLY 9 TRAINING EQUATIONS FOR 41 UNKNOWN WEIGHTS.
DON'T EXPECT MUCH WHEN YOU USE THIS NET FOR NONTRAINING DATA
UNLESS:
1. YOU USE STOPPED TRAINING WITH A VALIDATION SET AND/OR
2. YOU USE REGULARIZATION VIA TRAINBR AND/OR
3. YOU REDUCE H AND/OR
4. YOU INCREASE NTRN
WHAT DID YOU GET FOR
MSETRN00 = VAR(TTRN)
YTRN = SIM(NET,PTRN)
ETRN = TTRN-YTRN
MSETRN = MSE(ETRN)
R2TRN = 1-MSETRN/MSETRN00
HOPE THIS HELPS.
GREG
  1 Comment
Greg Heath
Greg Heath on 31 Jan 2012
WHEN YOU MAKE UP EXAMPLES, TAKE THEM FROM SAMPLING A SMOOTH FUNCTION.
TO BE MORE REALISTIC YOU CAN ADD SOME RANDOM NOISE CONTAMINATION.
MAKE SURE NEQ >= NW (PREFERABLY NEQ >> NW)UNLESS YOU ARE TESTING
WAYS TO MITIGATE OVERTRAINING AN OVERFIT NET.
HOPE THIS HELPS.
GREG
P.S. SEE THE OVERFITTING SECTION OF THE COMP.AI.NEURAL-NETS FAQ

Sign in to comment.

More Answers (0)

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!