Answers.Body: <p>You ask different questions in the title and in the body of the question, so I'll start from the title.</p>
  <p><strong>When do you know your neural network is learning?</strong></p>
  <p>The surprisingly simply answer to this question is to just <strong>TEST</strong> the model as frequently as you can during training. And testing does not mean to just compute metrics, those serve the purpose of <em>quantifying</em> the performance of your model, rather what you want to do is to set up a quick pipeline to apply your checkpoints to some real unseen data and check yourself if the predictions make sense. Doesn't matter if your dataset is unbalanced or not, you are in charge of selecting as many testing instances as you want to test the model, and the more edge/difficult cases you select the better.</p>
  <p>Also, save intermediate results during training. You have access to input images and labels, so for x amount of wrong classification you can easily save those input images, or save to a csv file the index of those training instances. Once you have a small sample of false positive and negatives, you can inspect specifically those samples for patterns.</p>
  <p><strong>What can we interpret from weights and activation output values?</strong></p>
  <p>It is true that plotting the histogram of weights values per layer is a common practice, but I think you probably already realized that there is no consensus on how to go from A to B when we notice something weird happening. So I wouldn't rely to much on these tools to conclude that you need a different architecture or weight initialization. On overall standard weight initialization strategies like xavier or kaiming have been proven to work just fine. If you have troubles training a good model you'll have much more chance to understand what is going wrong by looking at the data and trying specific losses for unbalanced tasks.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-10T12:03:01.267Z
Answers.Text: Thanks for your answer! Yeah I guess I was too stuck up on model side.
Answers.UserDisplayName: haneulkim
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-10T07:32:39.233Z
Answers.LastActivityDate: 2022-08-10T07:32:39.233Z
Answers.UserDisplayName: Edoardo Guerriero
Body: <p>When training a neural network for binary classification on a highly imbalanced set its training loss decreases, however validation loss increase even though accuracy is very high (due to highly imbalanced dataset) and its other metrics (auc, recall, precision) are bad.</p>
  <p>I want to figure out whether there is something wrong with the model architecture, therefore building a new model would be the right choice or is the model learning something; however you just need to tweak some hyperparameters.</p>
  <p>By plotting activation outputs and weights at each layer we can see if there is a vanishing/exploding gradient or saturation at a certain layer (activation output being on extremes when using saturating activation functions like tanh, sigmoid).</p>
  <p>My question is, is that only thing we can interpret from weights and activation output values?</p>
  <p>What can weights distribution of layers at each layer tell us?</p>
  <p>I'm very confused since from the <a href="https://www.datacamp.com/tutorial/tensorboard-tutorial" rel="nofollow noreferrer">DataCamp - TensorBoard Tutorial</a> it says: “Visualizing network weights is important, because if the weights are wildly jumping here and there during learning it indicates something is wrong with the weight initialization or the learning rate.”,</p>
  <p>however from:  <a href="https://stackoverflow.com/questions/42315202/understanding-tensorboard-weight-histograms">Stack Overflow - Understanding TensorBoard (weight) histograms</a> I’ve understood the answer as: &quot;changes in weight imply learning&quot; because the answerer looks at the first 3 layers (where their weights do not change at each iteration) and says that it is not learning, and looks at last layer (weight changes) and says that it is learning.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-10T14:50:55.027Z
Comments.Text: Running the risk of oversimplifying your problem, I still want to point out the obvious: A decreasing training loss, but increasing validation loss is bad.
Comments.UserDisplayName: Kroshtan
Tags: <machine-learning><deep-learning><weights-initialization>
Title: When do you know that your neural network is learning something when metrics are garbage?
UserDisplayName: haneulkim
ThreadText: # When do you know that your neural network is learning something when metrics are garbage?
  
  (Asked by: username_0 on 2022-08-10)
  
  When training a neural network for binary classification on a highly imbalanced set its training loss decreases, however validation loss increase even though accuracy is very high (due to highly imbalanced dataset) and its other metrics (auc, recall, precision) are bad.
  
  I want to figure out whether there is something wrong with the model architecture, therefore building a new model would be the right choice or is the model learning something; however you just need to tweak some hyperparameters.
  
  By plotting activation outputs and weights at each layer we can see if there is a vanishing/exploding gradient or saturation at a certain layer (activation output being on extremes when using saturating activation functions like tanh, sigmoid).
  
  My question is, is that only thing we can interpret from weights and activation output values?
  
  What can weights distribution of layers at each layer tell us?
  
  I'm very confused since from the [DataCamp - TensorBoard Tutorial](https://www.datacamp.com/tutorial/tensorboard-tutorial) it says: “Visualizing network weights is important, because if the weights are wildly jumping here and there during learning it indicates something is wrong with the weight initialization or the learning rate.”,
  
  however from: [Stack Overflow - Understanding TensorBoard (weight) histograms](https://stackoverflow.com/questions/42315202/understanding-tensorboard-weight-histograms) I’ve understood the answer as: "changes in weight imply learning" because the answerer looks at the first 3 layers (where their weights do not change at each iteration) and says that it is not learning, and looks at last layer (weight changes) and says that it is learning.
  
  **Tags:** machine-learning, deep-learning, weights-initialization
  > **Comments:**
  > **username_1**: Running the risk of oversimplifying your problem, I still want to point out the obvious: A decreasing training loss, but increasing validation loss is bad.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-08-10. Score: 1 | Accepted answer
  
  You ask different questions in the title and in the body of the question, so I'll start from the title.
  
  **When do you know your neural network is learning?**
  
  The surprisingly simply answer to this question is to just **TEST** the model as frequently as you can during training. And testing does not mean to just compute metrics, those serve the purpose of *quantifying* the performance of your model, rather what you want to do is to set up a quick pipeline to apply your checkpoints to some real unseen data and check yourself if the predictions make sense. Doesn't matter if your dataset is unbalanced or not, you are in charge of selecting as many testing instances as you want to test the model, and the more edge/difficult cases you select the better.
  
  Also, save intermediate results during training. You have access to input images and labels, so for x amount of wrong classification you can easily save those input images, or save to a csv file the index of those training instances. Once you have a small sample of false positive and negatives, you can inspect specifically those samples for patterns.
  
  **What can we interpret from weights and activation output values?**
  
  It is true that plotting the histogram of weights values per layer is a common practice, but I think you probably already realized that there is no consensus on how to go from A to B when we notice something weird happening. So I wouldn't rely to much on these tools to conclude that you need a different architecture or weight initialization. On overall standard weight initialization strategies like xavier or kaiming have been proven to work just fine. If you have troubles training a good model you'll have much more chance to understand what is going wrong by looking at the data and trying specific losses for unbalanced tasks.
  
  > **Comments:**
  > **username_0**: Thanks for your answer! Yeah I guess I was too stuck up on model side.  
  
  ---
  
  