Last active
October 27, 2019 06:08
-
-
Save guilhermefgs/80b6fd2e313a101189de5107faaf7f5d to your computer and use it in GitHub Desktop.
Inicialização aleatória dos parâmetros theta em redes neurais
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 randomInit(input_layer_size, hidden_layer_size, num_labels): | |
# Parâmetros da primeira camada (incluindo bias) | |
# As matrizes têm formato (num_entradas, num_saidas) | |
size1 = (hidden_layer_size, input_layer_size+1) | |
theta1_ini = np.random.normal(0, .1, size=size1) | |
# Parâmetros da primeira camada (incluindo bias) | |
size2 = (num_labels, hidden_layer_size+1) | |
theta2_ini = np.random.normal(0, .1, size=size2) | |
return (theta1_ini, theta2_ini) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment