简体   繁体   English

Numpy 连接中的 Memory 错误 (np.concatenate)

[英]Memory Error in Numpy concatenate (np.concatenate)

I'm using TfidfVectorizer and for that, I need to concatenate my training and testing data, which gives me a memory error.我正在使用 TfidfVectorizer,为此,我需要连接我的训练和测试数据,这给了我一个 memory 错误。

train_text = data['comment_text'].values.astype(str)
test_text = test_data['comment_text'].values.astype(str)
all_text = np.concatenate([train_text, test_text])

Above is the code piece and below is the error.上面是代码片段,下面是错误。

Traceback (most recent call last):
File "Model.py", line 68, in <module>
  EasyEnsembleClassfier(data,test_data)
File "Model.py", line 30, in EasyEnsembleClassfier
  all_text = np.concatenate([train_text, test_text])
MemoryError

Any suggestions on how to resolve this?关于如何解决这个问题的任何建议?

I think this is probably due to insufficient memory or the data size is very large.我认为这可能是由于 memory 不足或数据量非常大。 Can you try again by reducing the data size?您可以通过减小数据大小再试一次吗? You can also consider killing some unnecessary processes going on your machine (on windows -- you can do it by visiting control panel) to free up some memory.您还可以考虑杀死机器上的一些不必要的进程(在 windows - 您可以通过访问控制面板来完成)以释放一些 memory。 Let me know if it works.让我知道它是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM