I wrote a code for classification, using a” patternnet “neural network to classify a dataset which is 2D two spiral dataset, all my data were 40 in two classes each class population was 20, I manually separated it in two parts, part one training and validation and part two testing, so 32 out of 40 is associated in training and validation phase and 8 for testing, the separation process is randomly, I give data of part one to the net 90% for training, 10% for validation. net = patternnet(70); net.divideParam.trainRatio=0.9 net.divideParam.valRatio=0.1 net.divideParam.testRatio=0 then I use the trained net for testing the data of part two, my problem is no matter how many neurons I use, the classification result is perfect , over fitting doesn’t happen , even if I use 70 neurons , how such thing is possible? I should work with neural networks which are capable of over fitting easily, I use small size data sets which are distributed in a complex pattern, like spirals , or banana-shaped data sets , I would like to have them in higher dimension space but unfortunately I couldn’t generate them in higher spaces .
Kshitij Singh answered .
2025-11-20
1. Non-overfitting: Make sure that Ntrneq >= Nw 2. Validation stopping (a default data division that prevents overtraining an overfit net): total = design + test design = training + validation non-design = test total = training + non-training non-training = validation + testing
Use a non-training validation design set that stops training set weight estimation when performance on the non-training validation design subset fails to increase for a fixed number (default = 6) of epochs.
3. Regularization: Minimize the weighted sum of mean-square-error and mean-squared-weights via either
net.performParam.regularization = a ;% 0 < a < 1
or
net.trainFcn = 'trainbr';
Details can be obtained by searching for
a. Documentation on Validation stopping and regularization b. Relevant posts in both the NEWSGROUP and ANSWERS. Suitable search words are overfitting, overtraining, regularization, trainbr and validation stopping