MCPcopy Index your code
hub / github.com/lawlite19/MachineLearning_Python / randInitializeWeights

Function randInitializeWeights

NeuralNetwok/NeuralNetwork.py:191–195  ·  view source on GitHub ↗
(L_in,L_out)

Source from the content-addressed store, hash-verified

189
190# 随机初始化权重theta
191def randInitializeWeights(L_in,L_out):
192 W = np.zeros((L_out,1+L_in)) # 对应theta的权重
193 epsilon_init = (6.0/(L_out+L_in))**0.5
194 W = np.random.rand(L_out,1+L_in)*2*epsilon_init-epsilon_init # np.random.rand(L_out,1+L_in)产生L_out*(1+L_in)大小的随机矩阵
195 return W
196
197
198# 检验梯度是否计算正确

Callers 1

neuralNetworkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected