# [Rd] Help about nnet library

From: Pierre-Henri BUSSIERE <bussiere_at_numtech.fr>
Date: Wed, 14 Nov 2007 10:05:49 +0100

Hello,

First of all I am french, so please forgive me, if there are some big language mistakes in my sentences.

I do not know if it is the good mail address to send my question, if not please tell me and forgive me, I have also sent this quetion to r-help, because the answer could be known from the programmers and the other R users :).

I am working on a project, and I use the nnet library. Our customers do not want us to install R on their machine, so we just use R for making the training of our neurons network. This part is good and we have the weights for each neurons and each links.

The neuron network we used is a very simple one : 4 inputs for *one linear output* unit with just one hidden layer (with 5 neurons) between the inputs and the ouputs. So in R it is translated by the following network : 4-5-1. We have also a decay of 0.3, but I do not think that fact interfers in our computation.

And our problem is to recompute the output with those weights.

When we program it or making the computation by hand, we do not find the same result than R. We check our program, we remake the computation by hand and we find always the same result.

So one of our hypothesis is that, we do not use the good transfert function or the good activation function.

For example for the neuron 1 of the hidden layer we have the weights as follows :
b(which is I suppose the input set to one)->h1=w0

```i1->h1=w1
i2->h1=w2
i3->h1=w3
i4->h1=w4

```

So first we make this computation :
sum=w0 + i1*w1 + i2*w2 + i3*w3 + i4*w4 (the transfert function)

And for computing h1 we use the classic sigmoid function :

h1=1/(1+exp(-sum)).

And for calculating the output we have those weights : b->o=wo0

```i1->o=wo1
i2->o=wo2
i3->o=wo3
i4->o=wo4
h1->o=wo5
h2->o=wo6
h3->o=wo7
h4->o=wo8
h5->o=wo9

```

And the ouput is computed as follows :

o=wo0+wo1*i1+wo2*i2+wo3*i3+wo4*i4+wo5*h1+wo6*h2+wo7*h3+wo8*h4+wo9*h5.

So I would like to know, where is our error. Is it the sigmoid function that we used ? The transfert function ? Please answer me, I really need to know it.

Pierre-Henri BUSSIERE

```--
Pierre-Henri BUSSIERE
Ingénieur Informatique

------------------------------------
NUMTECH
6, allée Alan Turing
Parc Technologique de la Pardieu
BP 30242
63175 AUBIERE Cedex
FRANCE

------------------------------------
Tél. 04.73.28.75.95
Fax. 04.73.28.75.99

[[alternative HTML version deleted]]

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
```
Received on Wed 14 Nov 2007 - 21:30:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 14 Nov 2007 - 21:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.