「Your first neural network」で、
numpy.random.normal(平均, 標準偏差, (入力数, 出力数))
というように、ニューラルネットワークの重みを初期化することもありますが、標準偏差の設定が、
入力数**-0.5
という計算になっているのはなぜですか? 入力数に反比例している意味、または-0.5乗という定数の意味を教えてください。
Python
1 2class NeuralNetwork(object): 3 def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate): 4 # Set number of nodes in input, hidden and output layers. 5 self.input_nodes = input_nodes 6 self.hidden_nodes = hidden_nodes 7 self.output_nodes = output_nodes 8 9 # Initialize weights 10 self.weights_input_to_hidden = np.random.normal(0.0, self.input_nodes**-0.5, 11 (self.input_nodes, self.hidden_nodes)) 12 13 self.weights_hidden_to_output = np.random.normal(0.0, self.hidden_nodes**-0.5, 14 (self.hidden_nodes, self.output_nodes)) 15 self.lr = learning_rate 16 17 18 # 以下省略
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/22 12:26
2019/03/22 14:41