Answers.Body: <p>Both Keras and Torch provide a wide range of techniques for weight initialization. Like
  <strong>Zero initialization</strong> :- Initializing all weights to zero it is easy way to initialize the weights and biases but it is not very effective since all neuron learns same things and predicts same things which leads to symmetry breaking issue.</p>
  <p><strong>One initialization</strong> :- This method is as same as zero initialization in this method instead of zeros we initialize all weights with zeros but again it also leads to symmetry breaking down.</p>
  <p><strong>Random Initialization</strong> :- In this method weights are initialize based on normal or uniform distribution. This method is common and mostly use in initialization of the weights of neurons. and it also solves the problems like stucking at local minima. but there are chances of gradient vanishing and gradient exploding.</p>
  <p>As per Lynn said you can use the initialization like He and glorot which are used for specific types of layers which gives much better performance of that specific types of layers.</p>
  <p>For more information you can check this links</p>
  <p>for Keras :<a href="https://keras.io/api/layers/initializers/" rel="nofollow noreferrer">https://keras.io/api/layers/initializers/</a></p>
  <p>for pytorch:<a href="https://pytorch.org/docs/stable/nn.init.html" rel="nofollow noreferrer">https://pytorch.org/docs/stable/nn.init.html</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-11T19:33:14.237Z
Answers.LastActivityDate: 2023-12-11T19:33:14.237Z
Answers.UserDisplayName: Keval Pandya
Answers.Body: <p>Both <a href="https://www.tensorflow.org/api_docs/python/tf/keras/initializers" rel="nofollow noreferrer">Keras</a> and <a href="https://pytorch.org/docs/stable/nn.init.html" rel="nofollow noreferrer">PyTorch</a> provide a range of  initialization classes and functions. Of these, probably the two most commonly used are the Glorot (Xavier in Pytorch) and He (Kaiming in pytorch) initializers. Additionally, biases are commonly initialized to 0 - see for example this answer on Stack Overflow: <a href="https://stackoverflow.com/a/44885299">Initial bias values for a neural network</a>.</p>
  <p>Glorot initialization (<a href="https://proceedings.mlr.press/v9/glorot10a.html" rel="nofollow noreferrer">Glorot and Bengio: Understanding the difficulty of training deep feedforward neural networks Xavier</a>) was designed for NNs that use sigmoid or tanh activation functions.</p>
  <p>He initialization (<a href="http://openaccess.thecvf.com/content_iccv_2015/html/He_Delving_Deep_into_ICCV_2015_paper.html" rel="nofollow noreferrer">He at al.: Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification</a>) was designed for NNs that use rectifiers such as RELU.</p>
  <p>Each of these has a normal and uniform variant - i.e. the initial weights are chosen by sampling from a normal or uniform distribution with a mean of zero. They vary in the way the standard deviation of the normal distribution or limits of the uniform distribution are calculated. The Glorot initializer is based on the sum of the input and output units to the weight tensor, whereas the He initializer just uses the number of input units.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-02T09:29:17.707Z
Answers.LastActivityDate: 2023-12-02T09:29:17.707Z
Answers.UserDisplayName: Lynn
Answers.Body: <p>Yes, weight initialization in the network has had a high impact on the model. The choice of weight initialization depends on a few factors like the architecture of the neural network, activation function, and input data. you can share those things that help us help you with which activation function to use. e.g. if you are using Deep Network with ReLu then He initialization is a good choice, for a network with Sigmoid and Tanh use XavierGlorot.</p>
  <p>Here I am listing a few Weight initialization techniques and when to use them:</p>
  <p><strong>Zero:</strong></p>
  <ul>
  <li>All Weights are initialized to Zero.</li>
  <li>Mostly it is not recommended because it stops effective learning, because all the layers are going to learn almost the same features while training.</li>
  </ul>
  <p><strong>Random:</strong></p>
  <ul>
  <li>Weights are initialized with random values with the distribution of normal or uniform.</li>
  <li>It is better to break symmetry but it leads to vanishing and exploding gradient. Mostly in POCs, we start from this weighting technique.</li>
  </ul>
  <p><strong>Xavier/Glorot:</strong></p>
  <ul>
  <li>Weights are in distribution with 0 mean and std. deviation of the sqrt(2/(inputs+outputs))</li>
  <li>Useful when networks use tanh or sigmoid activation because it helps in maintaining variance of the activation function and back prop gradient</li>
  </ul>
  <p><strong>He:</strong></p>
  <ul>
  <li>It is similar to the Xavier with 0 mean and std. deviation of the sqrt(2/inputs).</li>
  <li>Ideals for networks like ReLU and variants. It helps in mitigation of the vanishing gradient.</li>
  </ul>
  <p><strong>Orthogonal:</strong></p>
  <ul>
  <li>In this weights are orthogonal metrics. This helps in norm preservation.</li>
  <li>Best suited for RNN because it helps in maintaining gradient magrnitude in deeper networks.</li>
  </ul>
  <p><strong>Sparse:</strong></p>
  <ul>
  <li>Some of the weights are set to non-zero values while others are zero.</li>
  <li>Useful in case of sparse network data type handing.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-12T07:00:25.827Z
Answers.LastActivityDate: 2023-12-12T07:00:25.827Z
Answers.UserDisplayName: Hiren Namera
Body: <p>When creating a neural network to predict the impact of risks on the project cost, what techniques are used to initialize the weights provided to the hidden layers and the output layer?</p>
  
Tags: <neural-networks><reference-request><weights-initialization>
Title: What are the techniques used to initialize weights for neural networks?
UserDisplayName: maya sy
ThreadText: # What are the techniques used to initialize weights for neural networks?
  
  (Asked by: username_0 on 2023-12-01)
  
  When creating a neural network to predict the impact of risks on the project cost, what techniques are used to initialize the weights provided to the hidden layers and the output layer?
  
  **Tags:** neural-networks, reference-request, weights-initialization
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2023-12-11. Score: 1
  
  Both Keras and Torch provide a wide range of techniques for weight initialization. Like
  **Zero initialization** :- Initializing all weights to zero it is easy way to initialize the weights and biases but it is not very effective since all neuron learns same things and predicts same things which leads to symmetry breaking issue.
  
  **One initialization** :- This method is as same as zero initialization in this method instead of zeros we initialize all weights with zeros but again it also leads to symmetry breaking down.
  
  **Random Initialization** :- In this method weights are initialize based on normal or uniform distribution. This method is common and mostly use in initialization of the weights of neurons. and it also solves the problems like stucking at local minima. but there are chances of gradient vanishing and gradient exploding.
  
  As per username_2 said you can use the initialization like He and glorot which are used for specific types of layers which gives much better performance of that specific types of layers.
  
  For more information you can check this links
  
  for Keras :<https://keras.io/api/layers/initializers/>
  
  for pytorch:<https://pytorch.org/docs/stable/nn.init.html>
  
  
  ---
  
  ### Answer by username_2 on 2023-12-02. Score: 1
  
  Both [Keras](https://www.tensorflow.org/api_docs/python/tf/keras/initializers) and [PyTorch](https://pytorch.org/docs/stable/nn.init.html) provide a range of initialization classes and functions. Of these, probably the two most commonly used are the Glorot (Xavier in Pytorch) and He (Kaiming in pytorch) initializers. Additionally, biases are commonly initialized to 0 - see for example this answer on Stack Overflow: [Initial bias values for a neural network](https://stackoverflow.com/a/44885299).
  
  Glorot initialization ([Glorot and Bengio: Understanding the difficulty of training deep feedforward neural networks Xavier](https://proceedings.mlr.press/v9/glorot10a.html)) was designed for NNs that use sigmoid or tanh activation functions.
  
  He initialization ([He at al.: Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification](http://openaccess.thecvf.com/content_iccv_2015/html/He_Delving_Deep_into_ICCV_2015_paper.html)) was designed for NNs that use rectifiers such as RELU.
  
  Each of these has a normal and uniform variant - i.e. the initial weights are chosen by sampling from a normal or uniform distribution with a mean of zero. They vary in the way the standard deviation of the normal distribution or limits of the uniform distribution are calculated. The Glorot initializer is based on the sum of the input and output units to the weight tensor, whereas the He initializer just uses the number of input units.
  
  
  ---
  
  ### Answer by username_3 on 2023-12-12. Score: 0
  
  Yes, weight initialization in the network has had a high impact on the model. The choice of weight initialization depends on a few factors like the architecture of the neural network, activation function, and input data. you can share those things that help us help you with which activation function to use. e.g. if you are using Deep Network with ReLu then He initialization is a good choice, for a network with Sigmoid and Tanh use XavierGlorot.
  
  Here I am listing a few Weight initialization techniques and when to use them:
  
  **Zero:**
  
  * All Weights are initialized to Zero.
  * Mostly it is not recommended because it stops effective learning, because all the layers are going to learn almost the same features while training.
  
  **Random:**
  
  * Weights are initialized with random values with the distribution of normal or uniform.
  * It is better to break symmetry but it leads to vanishing and exploding gradient. Mostly in POCs, we start from this weighting technique.
  
  **Xavier/Glorot:**
  
  * Weights are in distribution with 0 mean and std. deviation of the sqrt(2/(inputs+outputs))
  * Useful when networks use tanh or sigmoid activation because it helps in maintaining variance of the activation function and back prop gradient
  
  **He:**
  
  * It is similar to the Xavier with 0 mean and std. deviation of the sqrt(2/inputs).
  * Ideals for networks like ReLU and variants. It helps in mitigation of the vanishing gradient.
  
  **Orthogonal:**
  
  * In this weights are orthogonal metrics. This helps in norm preservation.
  * Best suited for RNN because it helps in maintaining gradient magrnitude in deeper networks.
  
  **Sparse:**
  
  * Some of the weights are set to non-zero values while others are zero.
  * Useful in case of sparse network data type handing.
  
  
  ---
  
  