Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:28:54+00:00 2026-06-15T21:28:54+00:00

I plan to use the Nguyen-Widrow Algorithm for an NN with multiple hidden layers

  • 0

I plan to use the Nguyen-Widrow Algorithm for an NN with multiple hidden layers. While researching, I found a lot of ambiguities and I wish to clarify them.

The following is pseudo code for the Nguyen-Widrow Algorithm

      Initialize all weight of hidden layers with random values
      For each hidden layer{
          beta = 0.7 * Math.pow(hiddenNeurons, 1.0 / number of inputs);
          For each synapse{
             For each weight{
              Adjust weight by dividing by norm of weight for neuron and * multiplying by beta value
            }
          } 
      }

Just wanted to clarify whether the value of hiddenNeurons is the size of the particular hidden layer, or the size of all the hidden layers within the network. I got mixed up by viewing various sources.

In other words, if I have a network (3-2-2-2-3) (index 0 is input layer, index 4 is output layer), would the value hiddenNeurons be:

NumberOfNeuronsInLayer(1) + NumberOfNeuronsInLayer(2) + NumberOfNeuronsInLaer(3)

Or just

NumberOfNeuronsInLayer(i) , where i is the current Layer I am at

EDIT:

So, the hiddenNeurons value would be the size of the current hidden layer, and the input value would be the size of the previous hidden layer?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:28:56+00:00Added an answer on June 15, 2026 at 9:28 pm

    Sounds to me like you want more precise code. Here are some actual code lines from a project I’m participating to. Hope you read C. It’s a bit abstracted and simplified. There is a struct nn, that holds the neural net data. You probably have your own abstract data type.

    Code lines from my project (somewhat simplified):

    float *w = nn->the_weight_array;
    float factor = 0.7f * powf( (float) nn->n_hidden, 1.0f / nn->n_input);
    
    for( w in all weight )
        *w++ = random_range( -factor, factor );
    
    /* Nguyen/Widrow */
    w = nn->the_weight_array;
    for( i = nn->n_input; i; i-- ){
        _scale_nguyen_widrow( factor, w, nn->n_hidden );
        w += nn->n_hidden;
    }
    

    Functions called:

    static void _scale_nguyen_widrow( float factor, float *vec, unsigned int size )
    {
        unsigned int i;
        float magnitude = 0.0f;
        for ( i = 0; i < size; i++ )
            magnitude += vec[i] * vec[i];
    
        magnitude = sqrtf( magnitude );
    
        for ( i = 0; i < size; i++ )
             vec[i] *= factor / magnitude;
    }
    
    static inline float random_range( float min, float max)
    {
        float range = fabs(max - min);
        return ((float)rand()/(float)RAND_MAX) * range + min;
    }
    

    Tip:
    After you’ve implemented the Nguyen/Widrow weight initialization, you can actually add a little code line in the forward calculation that dumps each activation to a file. Then you can check how good the set of neurons hits the activation function. Find the mean and standard deviation. You can even plot it with a plotting tool, ie. gnuplot. (You need a plotting tool like gnuplot anyway for plotting error rates etc.) I did that for my implementation. The plots came out nice, and the initial learning became much faster using Nguyen/Widrow for my project.

    PS: I’m not sure my implementation is correct according to Nguyen and Widrows intentions. I don’t even think I care, as long as it does improve the initial learning.

    Good luck,
    -Øystein

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I plan to use multiple AVAudioPlayers to play different audio files simultaneously. They are
I plan to use AQGridView which I found on github, it says: This project
I have a program for which I plan to use a lot of Timer
I don't wish to use authentication with my sync adaptor Since I plan to
we plan to use TIBCO EMS queues and TIBCO BW listeners on those queues
If I do a query (I plan to use SDS.P) against the global catalog,
Need an async I/O Processing Plan to use async I/O through aio* calls on
I am developing a web app for which I plan to use InnoDB. However
I'm looking for a a mouseover sound script (for button). I plan to use
I'm working on a document storage. Therefore I plan to use SqlServer 2012 with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.