From: Cemre Zor on 28 Mar 2010 20:40 Can I please learn why I'm always getting the same probability estimate (0.5) for each of the classes, even on the training set, on the following very easy problem? noClasses=10; nodes=2; epochs=20; for i=1:94 simplefitLabels(i)=mod(i,10)+1; simplefitInputs(i)=(i); simplefitTest(i)=2*(i); end simplefitTargets=[]; for c=1:noClasses simplefitTargets(c,:)=(simplefitLabels==c) end net = newfit(simplefitInputs,simplefitTargets,nodes); net.layers{1}.transferFcn='tansig'; net.layers{2}.transferFcn='logsig'; net.trainParam.show=0; net.divideFcn='divideind'; net.divideParam.trainInd=1:94; net.trainParam.epochs=epochs; net.trainParam.showWindow=0; net = train(net,simplefitInputs,simplefitTargets); simplefitOutputs =(sim(net,simplefitInputs)); Any help will highly be appreciated.
From: Cemre Zor on 28 Mar 2010 23:41 Should be sth to do with normalization (map to the relevant interval needed). I did this, now better, but still problematic -> net.outputs{2}.processParams{2}.ymin = 0; Btw, newfit should have been newff. "Cemre Zor" <cemree(a)gmail.com> wrote in message <hoost8$2n7$1(a)fred.mathworks.com>... > Can I please learn why I'm always getting the same probability estimate (0.5) for each of the classes, even on the training set, on the following very easy problem? > > noClasses=10; > nodes=2; > epochs=20; > > for i=1:94 > simplefitLabels(i)=mod(i,10)+1; > simplefitInputs(i)=(i); > simplefitTest(i)=2*(i); > end > > simplefitTargets=[]; > > for c=1:noClasses > simplefitTargets(c,:)=(simplefitLabels==c) > end > > net = newfit(simplefitInputs,simplefitTargets,nodes); > net.layers{1}.transferFcn='tansig'; > net.layers{2}.transferFcn='logsig'; > net.trainParam.show=0; > net.divideFcn='divideind'; > net.divideParam.trainInd=1:94; > net.trainParam.epochs=epochs; > net.trainParam.showWindow=0; > net = train(net,simplefitInputs,simplefitTargets); > > simplefitOutputs =(sim(net,simplefitInputs)); > > Any help will highly be appreciated.
From: Greg Heath on 29 Mar 2010 00:17 On Mar 28, 8:40 pm, "Cemre Zor" <cem...(a)gmail.com> wrote: > Can I please learn why I'm always getting the same > probability estimate (0.5) for each of the classes, > even on the training set, on the following very easy > problem? > > noClasses=10; > nodes=2; > epochs=20; Not enough nodes and not enough epochs for the problem you specified. > for i=1:94 Why 94 points instead of a multiple of 10? > simplefitLabels(i)=mod(i,10)+1; Why the "+1" ? Did you really want the first 9 data points to be in classes 2:10 and the 10th data point to be in class 1? > simplefitInputs(i)=(i); As stated this is a very difficult problem. Members of the same class are not clustered together. You will probably need about 94 nodes and only be able to memorize the training data. The net will probably have no predictive ability for nontraining data. > simplefitTest(i)=2*(i); Neural Nets don't extrapolate (very well). Half of this test data is outside of the domain of the training data. > end > simplefitTargets=[]; > > for c=1:noClasses > simplefitTargets(c,:)=(simplefitLabels==c) Did you forget a semicolon? > end > > net = newfit(simplefitInputs,simplefitTargets,nodes); > net.layers{1}.transferFcn='tansig'; > net.layers{2}.transferFcn='logsig'; > net.trainParam.show=0; > net.divideFcn='divideind'; > net.divideParam.trainInd=1:94; > net.trainParam.epochs=epochs; > net.trainParam.showWindow=0; > net = train(net,simplefitInputs,simplefitTargets); > > simplefitOutputs =(sim(net,simplefitInputs)); > > Any help will highly be appreciated. Try the problem where the first 10 of 100 data points belong to class 1, the next 10 to class 2 etc. Hope this helps. Greg
From: Cemre Zor on 29 Mar 2010 08:51 Thank you very much for the answer. Firstly, most of the problem (at least about the prob estimates' being the same always) has been solved by the map of the output labels. One thing I want to ask is: Greg Heath <heath(a)alumni.brown.edu> wrote in message <6ce2e9dd-c9ae-410a-9fbf-4a334e6ee4bc(a)33g2000yqj.googlegroups.com>... > On Mar 28, 8:40 pm, "Cemre Zor" <cem...(a)gmail.com> wrote: > > Can I please learn why I'm always getting the same > > probability estimate (0.5) for each of the classes, > > even on the training set, on the following very easy > > problem? > > > > noClasses=10; > > nodes=2; > > epochs=20; > > Not enough nodes and not enough epochs for the > problem you specified. > > > for i=1:94 > > Why 94 points instead of a multiple of 10? > > > simplefitLabels(i)=mod(i,10)+1; > > Why the "+1" ? Did you really want the first > 9 data points to be in classes 2:10 and the > 10th data point to be in class 1? > > > simplefitInputs(i)=(i); > The initial aim was to get rid of a class label "0". I also wanted to check what would happen in sense of classification accuracy. the "+1" seemed to me as a bias that nnets would be able account for, am I wrong here? > As stated this is a very difficult problem. > Members of the same class are not clustered > together. You will probably need about 94 > nodes and only be able to memorize the > training data. The net will probably have > no predictive ability for nontraining data. > > > simplefitTest(i)=2*(i); > > Neural Nets don't extrapolate (very well). > Half of this test data is outside of the > domain of the training data. > > > end > > simplefitTargets=[]; > > > > for c=1:noClasses > > simplefitTargets(c,:)=(simplefitLabels==c) > > Did you forget a semicolon? > > > > end > > > > net = newfit(simplefitInputs,simplefitTargets,nodes); > > net.layers{1}.transferFcn='tansig'; > > net.layers{2}.transferFcn='logsig'; > > net.trainParam.show=0; > > net.divideFcn='divideind'; > > net.divideParam.trainInd=1:94; > > net.trainParam.epochs=epochs; > > net.trainParam.showWindow=0; > > net = train(net,simplefitInputs,simplefitTargets); > > > > simplefitOutputs =(sim(net,simplefitInputs)); > > > > Any help will highly be appreciated. > > Try the problem where the first 10 of 100 data points > belong to class 1, the next 10 to class 2 etc. > > Hope this helps. > > Greg Thanks again .
From: Greg Heath on 29 Mar 2010 12:59 On Mar 29, 8:51 am, "Cemre Zor" <cem...(a)gmail.com> wrote: > Thank you very much for the answer. > Firstly, most of the problem (at least about the prob estimates' > being the same always) has been solved by the map of the output labels. > > One thing I want to ask is: > > Greg Heath <he...(a)alumni.brown.edu> wrote in message <6ce2e9dd-c9ae-410a-9fbf-4a334e6ee...(a)33g2000yqj.googlegroups.com>... > > On Mar 28, 8:40 pm, "Cemre Zor" <cem...(a)gmail.com> wrote: > > > Can I please learn why I'm always getting the same > > > probability estimate (0.5) for each of the classes, > > > even on the training set, on the following very easy > > > problem? > > > > noClasses=10; > > > nodes=2; > > > epochs=20; > > > Not enough nodes and not enough epochs for the > > problem you specified. > > > > for i=1:94 > > > Why 94 points instead of a multiple of 10? > > > > simplefitLabels(i)=mod(i,10)+1; > > > Why the "+1" ? Did you really want the first > > 9 data points to be in classes 2:10 and the > > 10th data point to be in class 1? > > > > simplefitInputs(i)=(i); > > The initial aim was to get rid of a class label "0". I also > wanted to check what would happen in sense of classification > accuracy. the "+1" seemed to me as a bias that nnets would > be able account for, am I wrong here? No. However, if you want to start out simple, then start out simple. Once it runs then add in complications. Your basic problem here is that you don't understand how the NN is going to classify the different classes. It has to set up boundaries between each class and the others. If every one dimensional data point is in a different class from it's two neighbors then you need 93 boundaries. This can be done with 93 hidden nodes and a gazillion epochs. If you only have 2 hidden nodes but use a gazillion epochs you still aren't going to do better than classifying all vectors as belonging to class 2. In that case the error rate is (84/94)*100% = 89.4% The NN is not a black box that will solve any problem given inputs and outputs. You have to put some thought into the data configuration and how the NN has to deal with it: GIGO Hope this helps. Greg > > As stated this is a very difficult problem. > > Members of the same class are not clustered > > together. You will probably need about 94 > > nodes and only be able to memorize the > > training data. The net will probably have > > no predictive ability for nontraining data. > > > > simplefitTest(i)=2*(i); > > > Neural Nets don't extrapolate (very well). > > Half of this test data is outside of the > > domain of the training data. _____SNIP
|
Pages: 1 Prev: how process each region of a grayscale image Next: 1D Function into 2D Function Interpolation |