0

So I have weights of a pretrained neural network but I'm kinda lost as to what each of the numbers mean. At all the neurons and at every layer of a netowrk, what do negative weights and positive weights mean? Does a weight that's away from 0 mean that it's very important?

chris4953
  • 1
  • 2

1 Answers1

0

First of all, are you sure that you need to understand those numbers? Large CNNs and RNNs may have millions of parameters.

The answer:

  1. Sign of weight means almost noting, it's like a coefficient in an equation.
  2. The absolute value of weight - distance from zero, though, means a lot. Large-abs weights produce strong output (which may be a sign of an overfitting)
K0mp0t
  • 89
  • 1
  • 6
  • Yes i'm afraid i do have to understand them. the one i'm working on is an RNN and it does indeed have millions of such weights. i need to zero down the most important weights within a neural network for a homework i'm working on. But coming to your second point, may i ask what you mean by strong output? – chris4953 Mar 23 '22 at 11:46
  • Output of NN's layers is tensor/matrix/vector (so if you make a barplot some of its values will excell, but thats only visualization). If we are talking about training/inference proccess, it means that your model focusing its attention on particular features, which means that other features are underattended and that may cause performance problems with real data. Real showcase from my experience - classifying wolves and huskies: wolves had show background when huskies didn't, so when it came to testing the model, huskies sometimes were misclassified as wolves because of white background. – K0mp0t Mar 23 '22 at 17:08
  • tysm for the example! so i have the output of the nn layers, which technically are the activations. but is there a way to know which weights in specific affect certain features? – chris4953 Mar 25 '22 at 01:15
  • Yes, though, it may be uninformative. If you're using Keras, `layer.output` will give you output of ONE layer for EVERY feature. If we are talking about SINGLE feature for ALL layers, then there is no way to visualize such a dependency, though, you may try to implement it yourself, but only if you have VERY simple NN architecture and little number of features, otherwise I wouldn't even try – K0mp0t Mar 25 '22 at 06:33
  • TYSM for all your help. One last question i had was about weights again. If all weights are kind of centralized towards zero, can we say that large negative or positive weights are important? Important as in such weights playing a big role during inference process? – chris4953 Mar 25 '22 at 16:42
  • The main purpose of training NN is to make it work with any data (no mater of distribution or something else) - to train a generalizing ability. So, when your NNs weights are centralized around zero, NN works with all features at the same "attention" level, though, when you have weights that outlie from majority, you NN will count some features as more important. So if your real world data differs from the training set at some point, there could be unpredictable/incorrect results, which will be the direct consequence of these outlying weights. – K0mp0t Mar 26 '22 at 06:31