# Regularization Week 1

**URL:** <https://community.deeplearning.ai/t/regularization-week-1/14209>\
**Category:** Improving Deep Neural Networks: Hyperparameter tun\
**Tags:** coursera-platform\
**Created:** [June 15, 2021, 5:34am UTC](https://community.deeplearning.ai/t/regularization-week-1/14209 "2021-06-15T05:34:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![duke\_786](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@duke\_786](https://community.deeplearning.ai/u/duke_786)\
**Post date:** [June 15, 2021, 5:34am UTC](https://community.deeplearning.ai/t/regularization-week-1/14209/1 "2021-06-15T05:34:28Z")

</div>

I do not get one thing in working assignment of Regularization Week1 that why are we using np.random.rand() in place of np.random.rand() . As much i knew rand() is for uniform distribution where we will have issues normally as due to steep increase and sudden decrease in gradient. Why dont we used np.random.randn() in place of that.

---

<div class="post-metadata">

**Author:** ![nramon](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/nramon/32/129097_2.png) [@nramon](https://community.deeplearning.ai/u/nramon)\
**Post date:** [June 16, 2021, 3:22pm UTC](https://community.deeplearning.ai/t/regularization-week-1/14209/2 "2021-06-16T15:22:59Z")

</div>

Hi, @duke_786.

In `forward_propagation_with_dropout` you are generating a mask of 1’s and 0’s to shut down neurons with a certain probability.

To put it simply, if you replace [np.random.rand](https://numpy.org/doc/stable/reference/random/generated/numpy.random.rand.html) with [np.random.randn](https://numpy.org/doc/stable/reference/random/generated/numpy.random.randn.html) you’ll be generating more 1’s than you intended ([here](https://community.deeplearning.ai/t/np-random-rand-vs-np-random-randn/1972/2)’s the reason).

You could adjust the expression to get the right percentage of 1’s with [np.random.randn](https://numpy.org/doc/stable/reference/random/generated/numpy.random.randn.html), by the way. It’s just not as straightforward as using [np.random.rand](https://numpy.org/doc/stable/reference/random/generated/numpy.random.randn.html).

Good luck with the assignment 🙂
