RuntimeWarning:在double_scalars中遇到溢出,停止执行代码

时间:2018-05-11 19:12:09

标签: python runtime-error anaconda

当我尝试执行这段代码时 我正在使用jupyter笔记本

for i in range(0,train_len):
    avg = (x1[i] + x2[i] + x3[i] + x4[i])/4
    h = x0*w0 + x1[i]*w1 + x2[i]*w2 + x3[i]*w3 + x4[i]*w4  
    error = avg - h
    w0 = w0 + n*error
    w1 = w1 + n*x1[i]*error
    w2 = w2 + n*x2[i]*error
    w3 = w3 + n*x3[i]*error
    w4 = w4 + n*x4[i]*error

遇到此错误

C:\Users\Md. Arif Ahmed\Anaconda3\lib\site-packages\ipykernel_launcher.py:3: RuntimeWarning: overflow encountered in double_scalars
  This is separate from the ipykernel package so we can avoid doing imports until
C:\Users\Md. Arif Ahmed\Anaconda3\lib\site-packages\ipykernel_launcher.py:5: RuntimeWarning: invalid value encountered in double_scalars
  """
C:\Users\Md. Arif Ahmed\Anaconda3\lib\site-packages\ipykernel_launcher.py:6: RuntimeWarning: invalid value encountered in double_scalars

C:\Users\Md. Arif Ahmed\Anaconda3\lib\site-packages\ipykernel_launcher.py:7: RuntimeWarning: invalid value encountered in double_scalars
  import sys
C:\Users\Md. Arif Ahmed\Anaconda3\lib\site-packages\ipykernel_launcher.py:8: RuntimeWarning: invalid value encountered in double_scalars

C:\Users\Md. Arif Ahmed\Anaconda3\lib\site-packages\ipykernel_launcher.py:9: RuntimeWarning: invalid value encountered in double_scalars
  if __name__ == '__main__':

我该如何解决这个问题?

0 个答案:

没有答案