How does a neural network work when one hidden layer has 25 units and the next one has 15? How does the output of 25 units get converted into 15 units?

Hi Mustafa,

Connects each of the 25 units outputs to the 15 units inputs of the second layer. For each connection, there will therefore potentially be a trainable parameter. These are not one-to-one connections (which is rarely the case). The number of units/layer and the number of layer are often determined by some ‘rules of thumb’, and I think there are even some mathematical theories on the subject.

Each layer is connected to the adjacent layer by a weight matrix ‘W’.

The size of the weight matrix matches the number of units on each side.

Hello @MUSTAFA_RIAZ,

That is because in the layer that has the 15 units, each unit does the following thing:

a^{[l]}_{\text{unit 1}} = w_1a^{[l-1]}_1 + w_2a^{[l-1]}_2 + ... + w_{25}a^{[l-1]}_{25} + b

[l] means the l-the layer.

Each unit takes all 25 components to compute to one a^{[l]}_{\text{unit ?}}.

One unit gives you one a^{[l]}_{\text{unit ?}}, 15 units give you 15.

Note that my symbols above are not universally accepted, and they just serve for this thread.

Cheers,

Raymond