The common mistakes are:
- Using the wrong random function to compute the mask. We need numbers evenly distributed between 0 and 1, so using np.random.randn will end badly.
- Creating the mask as a column vector instead of a matrix the same shape as A. See this thread for more discussion of that point.
- Forgetting to do the “inverse” calculation after applying the mask.