Skip to main content
GameDev.net gamedev.net
🔒 Locked

About neural network!!

Started by danice_366 Aug 8, 2005 at 3:31 AM 7 replies 1.4k views
Original Post
danice_366
danice_366
Is it possible the output of neural network be >1 or <0 by using sigmoid function as a layer activation function?
Kylotan
Kylotan
Not if you've done it properly. If I was any good at calculus I could prove it to you. Try putting in the largest and smallest possible values and see what you get. If you do actually want a different output, which sounds reasonable, you'll have to scale and/or offset it, I suppose.
silmaril
silmaril
Since the exponential function approaches zero as the exponent goes towards minus infinity and approaces infinity as the exponent approaches infinity, the entire expression will approach 1/(1+0)=1 and 1/(1+inf)=0.

So without scaling or using a different activation function, you cannot get an output outside [0,1].
johnnyBravo
johnnyBravo
Are there any other functions that you could use so you can get > 1 and < 0?
caffiene
caffiene
As kylotan mentioned, you can use the same function and scale or offset it depending on what values you require.

eg, Output x 100 will give a value between 0 and 100, (Output x 200) - 100 will give a value between -100 and 100, etc
johnnyBravo
johnnyBravo
Hmm im using sigmoid for a feed forward backprobagation network,

would I multiply it like this:
output = (1/(1+exp(-(input+bias))))*100
?

And would I modify anything in the training, as in the training i got calulations like:
1-output

like would I replace 1 with 100?

edit:
as I tried this, and the calculations no longer worked properly.
thx
Kylotan
Kylotan
JohnnyBravo, the offset/scaling thing is purely to get the end result into a form more useful for your game. Think of it as a filter for the output to make it compatible with your engine. It has no relevance to operation of the actual net itself and shouldn't play a part in the training process.
Timkin
Timkin
Quote:
Original post by johnnyBravo
Are there any other functions that you could use so you can get > 1 and < 0?


Just add an output layer as a linear sum of basis function activations. If
μi is the activation value of the i'th basis function, then the j'th output is given by
yj = Σi=1niwij)
=w'μ

where w' is the transpose of the output layer weight matrix w. When you come to train the network, if you were using gradient descent, you'd want an update rule for w along the lines of
w(k+1) = w(k) + ηdE/dw, where η is the learning rate and E is your error function over the output states.

Timkin

edit: and I've just noticed an AP said this before... apologies for the double up

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.