http://www.mathworks.com/matlabcentral/newsreader/view_thread/325240
MATLAB Central Newsreader  patternnet vs newff
Feed for thread: patternnet vs newff
enus
©19942015 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Mon, 17 Dec 2012 08:49:28 +0000
patternnet vs newff
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325240#893843
Barbara priwitzer
Hi<br>
<br>
I am trying to update some of my MATLAB scripts accordimg to the new nnetToolbox functions, but I cannot get some things to work. For example:<br>
<br>
old version: <br>
<br>
p = [0 0 1 1;<br>
0 1 0 1];<br>
t = [0 1 1 0 ];<br>
<br>
f = 'logsig'; <br>
net = newff(minmax(p),[2,1],{f,f}); <br>
<br>
net.IW{1,1}= [0.2 0.2; 0.2 0.2];<br>
net.LW{2,1}=[0.2 0.2];<br>
net.b{1,1} = [0 ;0];<br>
net.b{2,1} = 0;<br>
<br>
sim(net,p)<br>
Warning: NEWFF used in an obsolete way. <br>
> In obs_use at 18<br>
In newff>create_network at 127<br>
In newff at 102 <br>
See help for NEWFF to update calls to the new argument list.<br>
<br>
<br>
ans =<br>
<br>
0.5498 0.5548 0.5548 0.5596<br>
<br>
<br>
new version<br>
<br>
<br>
net = patternnet([2]); <br>
f = 'logsig'; <br>
net.layers{2}.transferFcn = f;<br>
net.layers{1}.transferFcn = f;<br>
net = configure(net,p,t);<br>
<br>
net.IW{1,1}= [0.2 0.2; 0.2 0.2];<br>
net.LW{2,1}=[0.2 0.2];<br>
net.b{1,1} = [0 ;0];<br>
net.b{2,1} = 0;<br>
<br>
net(p)<br>
<br>
ans =<br>
<br>
0.7700 0.7749 0.7749 0.7798<br>
<br>
<br>
The outputs of these two nets, which I thought should be identical are different. I do understand the output of the newffnet, but I don't see how it comes to the results in case of patternnet. <br>
<br>
Any help would be very much appreciated<br>
<br>
Barbara

Thu, 20 Dec 2012 06:46:17 +0000
Re: patternnet vs newff
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325240#894024
Greg Heath
"Barbara" wrote in message <kammao$48q$1@newscl01ah.mathworks.com>...<br>
> Hi <br>
> I am trying to update some of my MATLAB scripts accordimg to the new nnetToolbox functions, but I cannot get some things to work. For example: <br>
> old version: <br>
SNIP<br>
> f = 'logsig'; <br>
> net = newff(minmax(p),[2,1],{f,f}); <br>
> net.IW{1,1}= [0.2 0.2; 0.2 0.2];<br>
> net.LW{2,1}=[0.2 0.2];<br>
> net.b{1,1} = [0 ;0];<br>
> net.b{2,1} = 0; <br>
> net(p) <br>
> ans = 0.5498 0.5548 0.5548 0.5596<br>
> <br>
> new version <br>
> net = patternnet([2]); <br>
> net.layers{2}.transferFcn = f;<br>
> net.layers{1}.transferFcn = f;<br>
> net = configure(net,p,t);<br>
> net.IW{1,1}= [0.2 0.2; 0.2 0.2];<br>
> net.LW{2,1}=[0.2 0.2];<br>
> net.b{1,1} = [0 ;0];<br>
> net.b{2,1} = 0; <br>
> net(p) <br>
> ans = > 0.7700 0.7749 0.7749 0.7798<br>
<br>
> The outputs of these two nets, which I thought should be identical are different. I do understand the output of the newffnet, but I don't see how it comes to the results in case of patternnet. <br>
> <br>
> Any help would be very much appreciated<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
<br>
There are 3 generations of the NNTBX to consider. Each has different defaults that <br>
can be deduced, with pain, with the assistance of the commands help, doc and type<br>
<br>
RC = Regression and Curvefitting<br>
CP = Classification and Pattern Recognition<br>
<br>
1. net1 =newff(minmax(p), [H O], TF*, BTF, BLF, PF ) % RC and CP<br>
=> 'tansig' output/No IPF, OPF, or DDF<br>
2. a. net2 =newff(p, t, H, TF*, BTF, BLF, PF, IPF*, OPF*, DDF*) % RC and CP<br>
==> 'purelin' output/IPF, OPF and DDF defaults<br>
b. net3 =newfit(p, t, H, TF, BTF, BLF, PF, IPF, OPF, DDF) % RC (calls newff)<br>
==> same as newff with an added plot<br>
c. net4 =newpr(p, t, H, TF*, BTF, BLF, PF, IPF, OPF, DDF) % CP (calls newff)<br>
==>same as newff with 'tansig' output, 'trainscg' training and added CP plots<br>
3. a. net5 =feedforwardnet( H, TF ) % RC and CP<br>
b. net6 =fitnet( H, TF ) % RC (calls feedforwardnet)<br>
==> same as feedfordnet with an added plot<br>
c. net7 =patternnet( H, TF ) % CP (calls newff)<br>
==>same as newff with 'tansig' output, 'trainscg' training and added CP plots<br>
<br>
1. Instead of trying to compare net1 and net7, it is probably best to start with finding the differences among net1, net2 and net5.<br>
<br>
2. Nets 27 have input and output normalization via MAPMINMAX defaults that results in changes in weight values. So, I don't think just assigning the same weights to the different nets will help.<br>
<br>
3. The actual normalizations are probably performed in TRAIN. So it might be wise to override the IPF and OPF defaults and use TRAIN.<br>
<br>
4. If TRAIN is used the DDF option should be overridden to make sure all of the data is used for training.<br>
<br>
Please post any partial successes in understanding.<br>
<br>
Greg

Thu, 20 Dec 2012 06:57:09 +0000
Re: patternnet vs newff
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325240#894025
Greg Heath
"Barbara" wrote in message <kammao$48q$1@newscl01ah.mathworks.com>...<br>
> Hi<br>
> <br>
> I am trying to update some of my MATLAB scripts accordimg to the new nnetToolbox functions, but I cannot get some things to work. For example:<br>
> <br>
> old version: <br>
___SNIP<br>
> ans = 0.5498 0.5548 0.5548 0.5596 <br>
___SNIP<br>
> new version<br>
> ans = 0.7700 0.7749 0.7749 0.7798<br>
<br>
> The outputs of these two nets, which I thought should be identical are different. I do understand the output of the newffnet, but I don't see how it comes to the results in case of patternnet. <br>
> <br>
> Any help would be very much appreciated<br>
<br>
As stated in my previous post, there have been many changes between those versions. Some are readily apparent and some are subtle.<br>
<br>
It may be best to just make sure that you know how to use the new functions. Then after they have been tested on data, you can see how they compare with the older versions.<br>
<br>
Hope this helps.<br>
<br>
Greg