Jump to content
  • Advertisement
Sign in to follow this  
Trillian

Bogus Neural Network Output

This topic is 3672 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I've just completing recoding my old neural network code but, seeing the results of my first tests, I did something wrong. I'm currently using three layers : 12 input neurons, 30 hidden neurons, 12 output neurons. I use the following set of input values : [1 0 0 0 1 0 0 1 0 0 0 0] I randomize all output weights of the neurons between 0.0f and 1.0f and use the following code to do the forward propagation :
for (int i = 0; i < next.NeuronCount; ++i)
{
    float sum = 0.0f;
    for (int j = 0; j < NeuronCount; ++j)
        sum += values[j] * outputWeights[j, i];
    next.values = normalization(sum);
}

// ... Where "normalization" is currently the following sigmoid function :
public static float Sigmoid(float value)
{
    return (float)(1.0 / (1.0 + (System.Math.Exp((double)-value))));
}


The values I get in the output layers are all 0.99999924598f or something stupid like that. I don't know if the sigmoid function should be applied at each propagation step but that's how it was done in a sample I've found. Anyone has an idea of what I'm doing wrong?

Share this post


Link to post
Share on other sites
Advertisement
Your weights are all positive, which results in some huge values in the output layer. You should probably initialize your weights to be random numbers between -1.0 and 1.0, or something like that.

Share this post


Link to post
Share on other sites
Quote:
Original post by alvaro
Your weights are all positive, which results in some huge values in the output layer. You should probably initialize your weights to be random numbers between -1.0 and 1.0, or something like that.


Aaahhh, of course it had to be so simple. Thanks a lot for pointing that out. It now produces much more realistic results!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!