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

2 ビュー (過去 30 日間)
Mariem Harmassi
Mariem Harmassi 2012 年 9 月 1 日
This is the code i tried :
net = newff(P,T,S)
net = newff(P,T,S,TF,BTF,BLF,PF,IPF,OPF,DDF)
Description
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];
X=chrom(1,:);
net=newff(minmax(trainInput'),trainOutput',6);
trainInput =
1.0000 0.4000 0.2000 0.7000
trainOutput =
0.8000
>> 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 :
net.IW
ans =
[6x0 double]
[]
it seems there is no connection with input ,i entered 4 input why i just have 2 cell ?
  1 件のコメント
Greg Heath
Greg Heath 2012 年 9 月 1 日
編集済み: Greg Heath 2012 年 9 月 1 日
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)
or
2. The latest versions fitnet (regression & curvefitting) or patternnet ( classification & pattern recognition)

サインインしてコメントする。

採用された回答

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

その他の回答 (3 件)

Greg Heath
Greg Heath 2012 年 9 月 4 日
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.
Greg

Mariem Harmassi
Mariem Harmassi 2012 年 9 月 9 日
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 2012 年 9 月 10 日
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.

カテゴリ

Help Center および File ExchangeSupport Vector Machine Classification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by