Python RuntimeWarning:subtract中遇到溢出,RuntimeWarning:reduce中遇到溢出,RuntimeWarning:add中遇到溢出

Python RuntimeWarning:subtract中遇到溢出,RuntimeWarning:reduce中遇到溢出,RuntimeWarning:add中遇到溢出,python,nlp,integer-overflow,Python,Nlp,Integer Overflow,在实施CBOW模型的过程中,在训练单词向量时,我遇到了以下错误: /usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:7: RuntimeWarning: overflow encountered in subtract import sys /usr/local/lib/python3.6/dist-packages/numpy/core/fromnumeric.py:90: RuntimeWarning: overfl

在实施CBOW模型的过程中,在训练单词向量时,我遇到了以下错误:

/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:7: RuntimeWarning: overflow encountered in subtract
  import sys
/usr/local/lib/python3.6/dist-packages/numpy/core/fromnumeric.py:90: RuntimeWarning: overflow encountered in reduce
  return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:9: RuntimeWarning: overflow encountered in add
发布这篇文章,我正在处理的矩阵会被NaN值淹没。我不明白为什么在第一个时代总共16000个例子中,第13000个训练例子会发生这种情况。

涉及错误的具体行是:

矩阵U初始化如下:

U = np.random.randn(vocab_size, embedding_size)
U = normalize_rows(U)
可以找到我的colab笔记本的链接