How to write my own neural network transfer function which gives discrete outputs 1,2,3.
1 view (last 30 days)
Show older comments
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..
0 Comments
Accepted Answer
Greg Heath
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
More Answers (1)
Greg Heath
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
See Also
Categories
Find more on Define Shallow Neural Network Architectures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!