From: hasan batuk on
Hi, i am trying to learn NN toolbox. I tried to creat a networks that multiply the number by 3 and gives as output. For simplicity, i made the transfer function also linear. It works well but i tried to reach the same result by using the bias and weight values.
x -> input
y-> output

a= [ (w1*x + b1) * w2 ]+b2

but it ends up with same as the input value. I am really confused about it. it looks very simple but i couldnt find what i miss. Thanks for your time. the code is below


P=[1:4:200]; % training set
T=P*3; % target set

net=newff(P,T,1);
net.layers{1}.transferFcn = 'purelin'; % making transfer func. as linear

net=train(net,P,T);

y=sim(net,101) % giving a number say 101 as an input to system and taking 303 as output as expected.

% trying to reach same result by using weight and bias values. it ends up with 101, not 303.

a1=(net.iw{1,1}*101)+net.b{1}; % output of first layer

a2=(net.lw{2,1}*a1)+net.b{2} % output of second layer
From: Greg Heath on
On Aug 13, 10:47 am, "hasan batuk" <kapadokya...(a)yahoo.com> wrote:
> Hi, i am trying to learn NN toolbox. I tried to creat a networks that multiply the number by 3 and gives as output. For simplicity, i made the transfer function also linear. It works well but i tried to reach the same result by using the bias and weight values.
> x ->  input
> y-> output
>
> a= [ (w1*x + b1) * w2 ]+b2
>
> but it ends up with same as the input value. I am really confused about it. it looks very simple but i couldnt find what i miss. Thanks for your time. the code is below
>
> P=[1:4:200]; % training set
> T=P*3;       % target set
>
> net=newff(P,T,1);
> net.layers{1}.transferFcn = 'purelin';   % making transfer func. as linear

Can include this in the previous command.

> net=train(net,P,T);
>
> y=sim(net,101)   % giving a number say 101 as an input to system and taking 303 as output as expected.
>
> % trying to reach same result by using weight and bias values. it ends up with 101, not 303.
>
> a1=(net.iw{1,1}*101)+net.b{1};  % output of first layer
>
> a2=(net.lw{2,1}*a1)+net.b{2}    % output of second layer

help newff

Carefully read the explanations of IPF and OPF

Hope this helps.

Greg