1
$\begingroup$

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 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 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.

$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$
    – Kroshtan
    Aug 10, 2022 at 14:50

1 Answer 1

1
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Thanks for your answer! Yeah I guess I was too stuck up on model side. $\endgroup$
    – haneulkim
    Aug 10, 2022 at 12:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .