Forgot to mention that when i use the same matrix several times with "patternet" (e.g. matrix(:,[1 2 3])) i get identical weight and classification values.
MATLAB neural network classification different results
1 次查看(过去 30 天)
显示 更早的评论
Hello,
i used MATLAB function "patternet" to create 1 layer (10 neurons) neural network classifier to classify data into 3 classes with default attributes (training function, initializatio and ect.). Suppose have matrix - NxM with rows corresponding to observations and columns are classification features. I found that when i use different combination of same features i get different classification results. For example, using matrix(:,[1 2 3]) gives different classification results (and also different weight values of whole network) compared with matrix(:,[1 3 2]).
Can somebody explain why it is so? Is this drawback is fundamentally related to neural networks classification algorithm or some implementation features?
采纳的回答
Greg Heath
2014-5-26
When making multiple designs in a loop, use rng to initialize the random number generator BEFORE the loop. If the training function uses batch learning, the results will be independent of the order of the columns.
3 个评论
Image Analyst
2014-5-26
Gediminas's "Answer" moved to here:
I found that the problem is related to initialization of neural network weights. It gives the identical results every time i use same column configuration, but if i use rng('shuffle') each time i train and test network it gives different results even with the same column configuration. So the problem to me is now how to initialize randomly all weights without previous repetition without each time calling rng('shuffle')?
Greg Heath
2015-4-25
When training in a loop only initialize the RNG once: just before the outer loop
更多回答(2 个)
Greg Heath
2014-6-1
Remember that the state of the RNG changes every time it is called. Now,
1. Net creation is different for the obsolete functions newfit and newpr which call newff than the corresponding new functions fitnet and patternnet which call feedforwardnet.
2. Obsolete
a. Random weight initialization occurs at net creation
b. Random data division occurs at the beginning of training
3. Current
a. Weights are no longer assigned at creation
b. Weights can be assigned before training using configure
. c. Random data division occurs at the beginning of training
d. Train will only assign initial weights to a weightless net
Therefore, if you are training multiple nets of the current version in a loop, you have to use configure to initialize weights at the beginning of the loop.
Hope this helps
Greg
0 个评论
Hamza
2023-10-23
Hello everyone, I'm facing the same issue on CNN. When I shuffled the features, I obtained different accuracy values, which ideally should remain consistent. Do you have any suggestions on how to resolve this issue? I am using Malba 2023.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!