Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Simple Neural network calculated by hand different from Matlab output

Subject: Simple Neural network calculated by hand different from Matlab output

From: mathieu.chambraud@gmail.com

Date: 20 Jun, 2008 16:26:46

Message: 1 of 2

Here's an example to illustrate my problem constructing a neural
network (NN) under Matlab.

When I plot the target value (X) and the NN output (Y), for a real
value of 0.7 the NN output is at worse between 0.68 and 0.73 (pretty
bad but it was just a test!).
If I use the NN weights to calculate the output value by hand, I get a
0.75, wich is impossible for 0.7!

 So I must be wrong somewhere in the calculation of my output... The
network is a 2 inputs/3 hidden/1 output with Tangente sigmoide
activation for the hidden layer and linear activation for the output.
Here's the formula I used in Matlab:

-1.1261*tansig(-1.6589*0.6964+1.4776*0.6936+4.5965)
-0.013796*tansig(-2.6065*0.6964+ 4.3402 *0.6936+0.30321)
+1.2166*tansig( 0.88612*0.6964+0.11309 *0.6936+0.055821)+1.1116

------------------------------------------------------------
The weights :
-Weights to layer from input
[-1.6589 1.4776;
-2.6065 4.3402;
0.88612 0.11309]
-Weights to layer
[-1.1261 -0.013796 1.2166]
-Bias to layer 1
[4.5965;
0.30321;
0.055821]
-Bias to layer 2
[1.1116]

The 2 example inputs used to calculate the output are :
0.6964
0.6936

---------------------------------------------------------------
Thanks for your help!

Subject: Simple Neural network calculated by hand different from Matlab output

From: carlos lopez

Date: 22 Jun, 2008 22:44:02

Message: 2 of 2

mathieu.chambraud@gmail.com wrote in message
<7d19db9b-b6ed-4681-8849-b90c87ec55f5@a70g2000hsh.googlegroups.com>...
> Here's an example to illustrate my problem constructing a
neural
> network (NN) under Matlab.
>
> When I plot the target value (X) and the NN output (Y),
for a real
> value of 0.7 the NN output is at worse between 0.68 and
0.73 (pretty
> bad but it was just a test!).
> If I use the NN weights to calculate the output value by
hand, I get a
> 0.75, wich is impossible for 0.7!
Why do you feel that the result MUST be exactly 0.7? Please
state your assumptions.

<...snip...>
> Here's the formula I used in Matlab:
Your formula seems correct.
Regards
Carlos

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us