Counting Number of Parameters in Neural Networks

1

Note: This is an academics based problem.

So in a recent in-class quiz, we were asked that if we have an input layer consisting of 20 nodes along with 2 hidden layers (one of size 10 and the other of size 5), what will the total number of parameters in this network? How can we compute this?

Additionally, how do we know what shapes are they weights of? How can we determine which activation functions are suitable for such a neural network?

My idea was that (20*10) + (10*5) + (biases = 10+5) = 265. So 265 should be the number of parameters. For shapes/activation functions, from what I understand, it just depends on the data, no? Couldn't think of any way to directly predict it from this limited information

x89

Posted 2019-12-22T22:38:50.563

Reputation: 159

Question was closed 2020-09-27T22:28:14.940

1What do you think the answer should be? – Akavall – 2019-12-23T00:56:14.850

1@Akavall My idea was that (2010) + (105) + (biases = 10+5) = 265. So 265 should be the number of parameters. For shapes/activation functions, from what I understand, it just depends on the data, no? Couldn't think of any way to directly predict it from this limited information. – x89 – 2019-12-23T05:15:29.567

I am not an expert, but as far as I can tell, there is not enough information in the question to answer the part about activation functions. For hidden layers, ReLU seems to be default choice, but Tanh and Sigmoid could also be fine, the best way is to try and see. For output layer, you could answer it (linear for regression, sigmoid for binary classification, softmax for multi-class problem), but the question does not specify the type of output being generated. – Akavall – 2019-12-23T22:27:25.987

Answers

0

Actiavation function isnt a parameter.

But here is general formula for counting weghts:

Suppose for neural network with two hidden layers, inputs dimension is "I", Hidden number of neurons in Layer 1 is "H1", Hidden number of neurons in Layer 2 is "H2" And number of outputs is "O"

weights = (I+1)*H1 +(H1+1)*H2 +(H2+1)*O

Noah Weber

Posted 2019-12-22T22:38:50.563

Reputation: 4 932

Hi, I didn't mean that activation function is a parameter. I don't have any information regarding the outputs in this case. Then how can I use this formula? – x89 – 2019-12-23T09:01:08.770

https://towardsdatascience.com/counting-no-of-parameters-in-deep-learning-models-by-hand-8f1716241889 I tried following example 1.2 but again, I don't have the output so I don't know how to compute it. – x89 – 2019-12-23T09:02:22.160