Skip to content

Instantly share code, notes, and snippets.

@SkalskiP
Last active October 8, 2018 22:49
Show Gist options
  • Save SkalskiP/1dfae56a8f06d7203d239c5d8e8c0468 to your computer and use it in GitHub Desktop.
Save SkalskiP/1dfae56a8f06d7203d239c5d8e8c0468 to your computer and use it in GitHub Desktop.
Initiation of parameter values for each layer
def init_layers(nn_architecture, seed = 99):
np.random.seed(seed)
number_of_layers = len(nn_architecture)
params_values = {}
for idx, layer in enumerate(nn_architecture):
layer_idx = idx + 1
layer_input_size = layer["input_dim"]
layer_output_size = layer["output_dim"]
params_values['W' + str(layer_idx)] = np.random.randn(
layer_output_size, layer_input_size) * 0.1
params_values['b' + str(layer_idx)] = np.random.randn(
layer_output_size, 1) * 0.1
return params_values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment