Created
December 27, 2018 06:00
-
-
Save shangeth/973abd8e2bd75fd7813f925a4ad2a213 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dropout(X, drop_probability): | |
keep_probability = 1 - drop_probability | |
mask = np.random.uniform(0, 1.0, X.shape) < keep_probability | |
if keep_probability > 0.0: | |
scale = (1/keep_probability) | |
else: | |
scale = 0.0 | |
return mask * X * scale | |
x = np.random.randn(3,3) | |
dropout(x, 0.3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment