## How to write my own neural network transfer function which gives discrete outputs 1,2,3.

on 17 Sep 2013

### Greg Heath (view profile)

I need to get output of a single neuron either 1 or 2 or 3. That is output of a neuron is not just a single value it should multiple values (1,2,3). Please give me an idea about the structure of the neural network..

## Products

No products are associated with this question.

### Greg Heath (view profile)

on 18 Sep 2013

Not enough info.

Why do you need to do this?

Are inputs discrete or conntinuous?

If the former, you might be able to use hardlim.

If the latter, you will need 2 neurons.

What do you mean by network ... the 2-neuron configuration?

Hope this helps.

Thank you for formally accepting my answer.

Greg

sri

### sri (view profile)

on 19 Sep 2013

My inputs are continues.

I have 64 inputs and 10 outputs. Each output can have the value 1,2,3 discrete values. So that my network architecture is (64,number of neurons at hidden layer,10).

Since hardlim gives output 0 or -1 I can't apply that for my problem.

### Greg Heath (view profile)

on 19 Sep 2013

You don't need anything special. Just use fitnet with targets of 1,2,3. You will end up with a continuum of outputs. For example, if the first 5 outputs are

>> y1 = 0.5 + 2.99*rand(10,5)

y1 =

```    2.9842    0.6613    2.8749    0.7506    3.3761
2.2499    2.0871    1.4305    1.1846    0.5139
2.1437    2.8297    2.0803    3.2309    2.8170
3.2424    3.2927    0.9953    0.9556    2.9437
1.3547    0.8884    2.2999    2.9692    3.0974
2.7640    2.2008    1.2863    2.1096    0.7525
2.7536    1.9035    2.4557    3.4784    1.6954
1.6375    0.5356    2.5608    0.7337    1.2770
2.1978    1.5080    2.7370    1.8236    2.8922
0.7268    0.9849    1.8471    0.8189    1.7899```

>> y = round(y1)

y =

```     3     1     3     1     3
2     2     1     1     1
2     3     2     3     3
3     3     1     1     3
1     1     2     3     3
3     2     1     2     1
3     2     2     3     2
2     1     3     1     1
2     2     3     2     3
1     1     2     1     2```

Hope this helps.

Thank you for formally accepting my answer

Greg

sri

### sri (view profile)

on 19 Sep 2013

Thanks.

I will try this method.