Skip to content

Instantly share code, notes, and snippets.

@Alescontrela
Last active June 15, 2018 04:50
Show Gist options
  • Save Alescontrela/9d12a0c26abf82bc222ddb24bcd594c2 to your computer and use it in GitHub Desktop.
Save Alescontrela/9d12a0c26abf82bc222ddb24bcd594c2 to your computer and use it in GitHub Desktop.
def initializeFilter(size, scale = 1.0):
'''
Initialize filter using a normal distribution with and a
standard deviation inversely proportional the square root of the number of units
'''
stddev = scale/np.sqrt(np.prod(size))
return np.random.normal(loc = 0, scale = stddev, size = size)
def initializeWeight(size):
'''
Initialize weights with a random normal distribution
'''
return np.random.standard_normal(size=size) * 0.01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment