Last active
October 8, 2018 22:49
-
-
Save SkalskiP/1dfae56a8f06d7203d239c5d8e8c0468 to your computer and use it in GitHub Desktop.
Initiation of parameter values for each layer
This file contains hidden or 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 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