Python MemoryError:无法分配足够的内存

时间:2019-07-30 15:45:36

标签: python data-science decision-tree

我正在尝试使用机器学习算法来建立将目标输出变量与两个单独的输入变量相关联的模型,并且在我运行model.fit(X,Y)时遇到内存错误,提示它无法分配5.7GB,考虑到我有8GB的ram并且没有与pycharm同时打开其他程序/窗口,这似乎很奇怪。

编辑:我使用的是64位python,据我了解,它会自动分配所需的内存

这是重试后错误消息的最后几行,这一次它甚至无法分配4GB:

File "sklearn\tree\_tree.pyx", line 145, in sklearn.tree._tree.DepthFirstTreeBuilder.build
  File "sklearn\tree\_tree.pyx", line 243, in sklearn.tree._tree.DepthFirstTreeBuilder.build
  File "sklearn\tree\_tree.pyx", line 740, in sklearn.tree._tree.Tree._add_node
  File "sklearn\tree\_tree.pyx", line 712, in sklearn.tree._tree.Tree._resize_c
  File "sklearn\tree\_utils.pyx", line 41, in sklearn.tree._utils.safe_realloc
MemoryError: could not allocate 4062707712 bytes

0 个答案:

没有答案