# NN layers with several units

**URL:** <https://community.deeplearning.ai/t/nn-layers-with-several-units/508275>\
**Category:** Advanced Learning Algorithms\
**Tags:** week-module-1\
**Created:** [December 1, 2023, 11:33am UTC](https://community.deeplearning.ai/t/nn-layers-with-several-units/508275 "2023-12-01T11:33:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lev\_Tsarin](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@Lev\_Tsarin](https://community.deeplearning.ai/u/Lev_Tsarin)\
**Post date:** [December 1, 2023, 11:33am UTC](https://community.deeplearning.ai/t/nn-layers-with-several-units/508275/1 "2023-12-01T11:33:54Z")

</div>

Hi everyone,  
I encountered a question that bother me; Probably it will be answered during the course, but still:

While, for instance, the first layer outputs vector “a” with 5 values, and the second layer, which has 3 neuron units, takes it as input. What’s the difference between each logistic regression within the layer( how do those 3 neuron units differ)?  
Since I thought they should be completely the same, since they all minimize cost function, no? Or do values of parameters (w,b) differ somehow from neuron units within one layer?  
may be I misused some terminology, I would appreciate pointing it out as well as an answer to this question.  
Thanks!

---

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [December 1, 2023, 11:50am UTC](https://community.deeplearning.ai/t/nn-layers-with-several-units/508275/2 "2023-12-01T11:50:53Z")

</div>

> [@Lev\_Tsarin](#):
>
> do values of parameters (w,b) differ somehow from neuron units within one layer?

Yes, they are different and each contributes to minimizing the cost function.

---

<div class="post-metadata">

**Author:** ![Lev\_Tsarin](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@Lev\_Tsarin](https://community.deeplearning.ai/u/Lev_Tsarin)\
**Post date:** [December 1, 2023, 3:52pm UTC](https://community.deeplearning.ai/t/nn-layers-with-several-units/508275/3 "2023-12-01T15:52:56Z")

</div>

but how? I mean, shouldn’t it be the only 2 true values(w which is actually may be vector, and b) to reach the global minimum?

---

<div class="post-metadata">

**Author:** ![saifkhanengr](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/saifkhanengr/32/152858_2.png) [@saifkhanengr](https://community.deeplearning.ai/u/saifkhanengr)\
**Post date:** [December 1, 2023, 3:55pm UTC](https://community.deeplearning.ai/t/nn-layers-with-several-units/508275/4 "2023-12-01T15:55:49Z")

</div>

I am talking about W which is an array and has different values for all w\_n. The same for b.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [December 2, 2023, 2:59am UTC](https://community.deeplearning.ai/t/nn-layers-with-several-units/508275/5 "2023-12-02T02:59:06Z")

</div>

In a neural network with one hidden layer, there will be two weight matrices.

W1 connects the input layer and the hidden layer.

- It’s size is the number of input units by the number of hidden layer units.
- There is a bias weight for each hidden layer unit.

W2 connects the hidden layer and the output layer.

- Its size is the number of hidden layer units by the number of outputs.
- There is a bias weight for each output unit. If there is 1 output, then W2 is a vector.

Note that the Weight matrices may be transposed, it depends on how the assignment was defined.
