Skip to content

Instantly share code, notes, and snippets.

@nanotroy
Created June 24, 2019 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nanotroy/2b6911afa2fb20faf3e89ebdf58e31a2 to your computer and use it in GitHub Desktop.
Save nanotroy/2b6911afa2fb20faf3e89ebdf58e31a2 to your computer and use it in GitHub Desktop.
def setParameters(X, Y, hidden_size):
np.random.seed(3)
input_size = X.shape[0] # number of neurons in input layer
output_size = Y.shape[0] # number of neurons in output layer.
W1 = np.random.randn(hidden_size, input_size)*np.sqrt(2/input_size)
b1 = np.zeros((hidden_size, 1))
W2 = np.random.randn(output_size, hidden_size)*np.sqrt(2/hidden_size)
b2 = np.zeros((output_size, 1))
return {'W1': W1, 'W2': W2, 'b1': b1, 'b2': b2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment