Effacer les filtres
Effacer les filtres

I tried to create a neural networks but what's wrong ?

2 vues (au cours des 30 derniers jours)
Mariem Harmassi
Mariem Harmassi le 1 Sep 2012
This is the code i tried :
net = newff(P,T,S)
net = newff(P,T,S,TF,BTF,BLF,PF,IPF,OPF,DDF)
newff(P,T,S) takes,
  • P - RxQ1 matrix of Q1 representative R-element input vectors.
  • T - SNxQ2 matrix of Q2 representative SN-element target vectors.
  • Si - Sizes of N-1 hidden layers, S1 to S(N-1), default = [].
(Output layer size SN is determined from T.) and returns an N layer feed-forward backprop network.
This a description that i found .So i follow the instructions to create a neural network with one hidden layer composed of 6 nodes .
trainInput=[1 0.4 0.2 0.7]
trainOutput=[0.8 ]
chrom=[0.5 0.6 0.8 0.6 0.7 0.9 0.8 0.4 0.5 0.9 0.9;
0.1 0.7 0.6 0.7 0.9 0.5 0.9 0.2 0.4 0.5 0.9];
trainInput =
1.0000 0.4000 0.2000 0.7000
trainOutput =
>> net.IW
ans =
[6x0 double]
>> net.LW
ans =
[] []
[0x6 double] []
>> net.b
ans =
[6x1 double]
[0x1 double]
I didn't underdtand what does this notation means :
ans =
[6x0 double]
it seems there is no connection with input ,i entered 4 input why i just have 2 cell ?
  1 commentaire
Greg Heath
Greg Heath le 1 Sep 2012
Modifié(e) : Greg Heath le 1 Sep 2012
The description you mention is either innaccurate or you have misinterpreted it.
Where, exactly, is ist?
Try to duplicate the results from the one or more of the demos and/or examples in the NN TBX.
What version do you have?
newff is now osolete, do you have either
1. The later versions newfit (regression & curvefitting) or newpr ( classification & pattern recognition)
2. The latest versions fitnet (regression & curvefitting) or patternnet ( classification & pattern recognition)

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 1 Sep 2012
One cell per layer, it appears to me.
You can view the contents by requesting net.b{1} and net.b{2}

Plus de réponses (3)

Greg Heath
Greg Heath le 4 Sep 2012
1. You need the same number of training targets as you have inputs.
[I N ] = size(trainInputs)
[ O N ] = size(trainOutputs)
This will result in Neq = N*O training equations
2. Correct your I-H-O network creation command
net = newff(trainInput, trainOutput, H)
This will automatically result in Nw = (I+1)*H+(H+1)*O random initial weights. For (I,H,O) = (1,6,1), Nw = 12+7 = 19
3. You need to train the net to solve the Neq equations from (trainInputs,trainOutputs)for Nw unknown final weights.
net = train(net,trainInputs,trainOutputs);
4. Don't expect good results unless 0.7*N >> Nw = 19. If you cannot substantially increase the amount of training data,decrease H.
5. Try one or more of the examples or demos in the documentation.
Hope this helps.

Mariem Harmassi
Mariem Harmassi le 9 Sep 2012
think u for answering i have resolved the problem .and my code can genrate good results . But how can I randomly divide my dataset into k parts ??

Greg Heath
Greg Heath le 10 Sep 2012
Please do not use the answer space for comments and/or asking additional unrelated questions.
The zeros in the weight vector cell components do not occur when the input and output data matrices have the same number of columns. I have not checked the source code to determine why.
The answer to your second question is:
help cvpartition
doc cvpartition
The documentation contains examples of implementing k-fold crossvalidation with the classify function.
However, there are no NN examples in the documentation. Nevertheless, I have written straightforward code that implements NN k-fold crossvalidation.
Try searching in the Newsgroup archives.
Thank you for reconsidering your official accepted answer.


En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by