# Number of parameters in an artificial neural network for AIC

How can I calculate the number of parameters in an artificial neural network in order to calculate its AIC?

• This question seems perfectly clear to me. Commented Sep 28, 2015 at 17:16
• You can use the command classifier.summary() from sklear class. Commented Feb 23, 2018 at 0:09

This network is fully connected, although networks don't have to be (e.g., designing a network with receptive fields improves edge detection in images). With a fully connected ANN, the number of connections is simply the sum of the product of the numbers of nodes in connected layers. In the image above, that is $(3\times 4) + (4\times 2) = 20$. That image does not show any bias nodes, but many ANNs do have them; if so, include the bias node in the total for that layer. More generally (e.g., if your ANN isn't fully connected), you can simply count the connections.
• To expand on the comment of @agcala including the bias, the computation for the number of parameters is $s_{j+1}\times{\left(s_{j}+1\right)}$ where $j$ is the index of a layer and $s$ the number of nodes in that layer. So, in this example, we have $\left(4\times{4}\right)+\left(2\times{5}\right)=26$. Commented Jan 29, 2022 at 20:55