RuntimeWarning:遇到溢出

时间:2017-12-01 17:35:16

标签: python machine-learning neural-network jupyter-notebook

在构建一个简单的神经网络来读取数字时,我收到了这个警告: 运行时警告:

C:\anaconda\lib\site-packages\ipykernel_launcher.py:4: RuntimeWarning: 
overflow encountered in square
after removing the cwd from sys.path.
Googeling对它的含义和解决方案没有任何重要意义。 有人会解释吗?

enter image description here

以下是一些代码,如果它有帮助:

w1_2 = np.random.rand(784,10)/100
w2_3 = np.random.rand(10,10)/100
w3_4 = np.random.rand(10,10)/100
b2 = np.random.rand(10)/100
b3 = np.random.rand(10)/100
b4 = np.random.rand(10)/100

for gd_up in range(1000):
    b2gd = []
    b3gd = []
    b4gd = []
    w12gd = []
    w23gd = []
    w34gd = []
    c = []
    for pic,pic_ca in zip(digits_train,digits_train_ca):
        b2,b3,b4,w12,w23,w34 = get_GD(pic,int(pic_ca))
        b2gd.append(b2)  
        b3gd.append(b3)
        b4gd.append(b4)
        w12gd.append(w12)
        w23gd.append(w23)
        w34gd.append(w34)
        c.append(get_c(feedforward(pic),int(pic_ca)))
    b2_f = sum(b2gd)/len(b2gd)
    b3_f = sum(b3gd)/len(b3gd)
    b4_f = sum(b4gd)/len(b4gd)
    w12_f = sum(w12gd)/len(w12gd)
    w23_f = sum(w23gd)/len(w23gd)
    w34_f = sum(w34gd)/len(w34gd)
    b2 = b2-(0.01*b2_f)
    b3 = b3-(0.01*b3_f)
    b4 = b4-(0.01*b4_f)
    w1_2 = w1_2-(0.01*w12_f)
    w2_3 = w2_3-(0.01*w23_f)
    w3_4 = w3_4-(0.01*w34_f)
    print(np.mean(c))

0 个答案:

没有答案