How can I correctly classify inputs for a neuronal network?

1 view (last 30 days)
I am having problems with my neuronal network. I have trained a radial basis function network for classification, But I can't make the network work when I enter a new value for a simulation. This is my code:
entrenar=[54x769]; %54 images TARGET=[4x54]; %4 targets
net=newrb(entrenar',TARGET, 0.009, 4); [net,pr]=traingd(net, entrenar', TARGET); y=net(entrenar');
Till now, everything is fine. The problem comes when I want to classify a new image. I have tried with 4 new images:
d=[769x4]; y2=sim(net,d);
the result it's the same for the 4 images. I've tried with more inputs for sim(), also using mean squared error goal 0. How can I fix it? please anybody help me

Accepted Answer

Greg Heath
Greg Heath on 20 Jun 2014
1. Unlike the MLP classifier (patternnet), the RBF classifier (newrb) is automatically trained, without trn/val/tst data division, when it is created. Therefore a. Data division (0.7,0.15,0.15 ?)must be performed, explicitly, before the call of newrb. b. Only use training data in the call of newrb. c. Do not use train. d. Choose the best of multiple designs using the val data. e. Obtain an UNBIASED estimate of performance on unseen data using the tst data
2. The input dimension of I = 769 is at least an order of magnitude too large for a practical net. It is a prime number, so it is not just an unfolding (image(:)). So my 1st question is, how was the input obtained?
3. The number of examples, N = 54, can at most, define a 53-D space. So there, needs to be a drastic dimensionality reduction.
4. If you are considering PCA for dimensionality reduction feature extraction, that may not be the best choice for classification. I recommend using PLS to maximize class separation instead of PCA which maximizes the class mixture spread.
5. After the dimensionality reduction, transform the inputs via zscore or mapstd to have zero-mean and unit-variance.
6. For c classes, the target should consist of columns from the c-dimensional unit matrix eye(c) (Do you have c=4?).
7. Find the optimal spread via trial and error. Considering the zscore input normalization, start with spread = 1 and change it by factors of 2 to narrow the search range (e.g.,[ ...,0.25, 0.5,1,2,4,...]
8. For an I-H-c node topology, try the practical training goal
MSEgoal = 0.01*Ndof*mean(var(target'))/Ntrneq
where
Ntrneq = Ntrn*c % Number of training equations
Ndof = Ntrneq - Nw % Number of estimation degrees of freedom (see Wikipedia)
Nw = (I*H+1)+H+1)*c % Number of estimated weights
See some of my posted examples in the NEWSGROUP and ANSWERS. Search on
greg newrb
Hope this helps.
Thank you for formally accepting my answer
Greg

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!