From: guorong li on
Hi, everyone:

I'm studing BP network. Usage of 'newff' functions is updated, however, traditional usage is also done.
But they cannot get the same results. And I find that the result of traditional usage is better than new one.

For example:
-----------------------------------------------------

P = [0 1 2 3 4 5 6 7 8 9 10];
T = [0 1 2 3 4 3 2 1 2 3 4];

% New usage
net = newff(P,T,5, {'tansig', 'purelin'});
net.trainParam.epochs = 50;
net.trainParam.goal=0.0001;
net = train(net,P,T);
Y = sim(net,P);

% Old usage
net2=newff(minmax(P), [5 1], {'tansig', 'purelin'});
net2.trainParam.epochs = 50;
net2.trainParam.goal=0.0001;
net2 = train(net2,P,T);
Y2 = sim(net2,P);

plot(P,T,P,Y,'o',P,Y2,'*')

------------------------------------------------------------------

Although these weights and biases are different, the result of old usage is always better. And the number of training of old usage is larger than the new one.

I don't know the reason.

Please help me.

thanks a lot.
From: Greg Heath on
On Oct 20, 4:11 pm, "guorong li" <fulcru...(a)hotmail.com> wrote:
> Hi, everyone:
>
> I'm studing BP network. Usage of 'newff' functions is updated, however, traditional usage is also done.
> But they cannot get the same results. And I find that the result of traditional usage is better than new one.
>
> For example:
> -----------------------------------------------------
>
> P = [0 1 2 3 4 5 6 7 8 9 10];
> T = [0 1 2 3 4 3 2 1 2 3 4];
>
> % New usage
> net = newff(P,T,5, {'tansig', 'purelin'});
> net.trainParam.epochs = 50;
> net.trainParam.goal=0.0001;
> net = train(net,P,T);
> Y = sim(net,P);
>
> % Old usage
> net2=newff(minmax(P), [5 1], {'tansig', 'purelin'});
> net2.trainParam.epochs = 50;
> net2.trainParam.goal=0.0001;
> net2 = train(net2,P,T);
> Y2 = sim(net2,P);
>
> plot(P,T,P,Y,'o',P,Y2,'*')
>
> ------------------------------------------------------------------
>
> Although these weights and biases are different, the result of old usage is always better. And the number of training of old usage is larger than the new one.
>
> I don't know the reason.
>
> Please help me.
>
> thanks a lot.

1. Reset the random number generators to the same
state in order to get an unbiased comparison.
2. Type

help newff
doc newff

to compare the defaults for each.

I know the newer version forces some options that are not necessarily
optimal.

Hope this helps.

Greg

From: Greg Heath on
On Oct 20, 5:44 pm, Greg Heath <he...(a)alumni.brown.edu> wrote:
> On Oct 20, 4:11 pm, "guorong li" <fulcru...(a)hotmail.com> wrote:
>
> > Hi, everyone:
>
> > I'm studing BP network. Usage of 'newff' functions is updated, however, traditional usage is also done.
> > But they cannot get the same results. And I find that the result of traditional usage is better than new one.
>
> > For example:
> > -----------------------------------------------------
>
> > P = [0 1 2 3 4 5 6 7 8 9 10];
> > T = [0 1 2 3 4 3 2 1 2 3 4];
>
> > % New usage
> > net = newff(P,T,5, {'tansig', 'purelin'});
> > net.trainParam.epochs = 50;
> > net.trainParam.goal=0.0001;
> > net = train(net,P,T);
> > Y = sim(net,P);
>
> > % Old usage
> > net2=newff(minmax(P), [5 1], {'tansig', 'purelin'});
> > net2.trainParam.epochs = 50;
> > net2.trainParam.goal=0.0001;
> > net2 = train(net2,P,T);
> > Y2 = sim(net2,P);
>
> > plot(P,T,P,Y,'o',P,Y2,'*')
>
> > ------------------------------------------------------------------
>
> > Although these weights and biases are different, the result of old usage is always better. And the number of training of old usage is larger than the new one.

I don't understand the meaning of the last sentence.


> > I don't know the reason.
>
> > Please help me.
>
> > thanks a lot.
>
> 1. Reset the random number generators to the same
> state in order to get an unbiased comparison.
> 2. Type
>
> help newff
> doc newff
>
> to compare the defaults for each.
>
> I know the newer version forces some options that are not necessarily
> optimal.

I took a quick look. The new version uses
MAPMINMAX as a default.

Hope this helps.

Greg