如何解决内存错误?我应该增加内存限制吗?
我正在加载它,但说明了错误。
import pandas as pd
import numpy as np
userMovie = np.load('userMovieMatrixAction.npy')
numberUsers, numberGenreMovies = userMovie.shape
genreFilename = 'Action.csv'
genre = pd.read_csv(genreFilename)
MemoryError:无法分配3.63 GIB的形状(487495360)和数据类型Float64 我能做些什么?这让我发疯。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果程序用完了内存,则似乎是 usercommit处理 。如果您在Linux中,则可以尝试运行以下命令以启用“始终过度使用”模式,这可以帮助您加载3.63GIB NPY文件,其中
> numpy
:If the program runs out of memory, it seems like an issue with overcommit handling of your operative system. If you are in Linux, you can try to run the following command to enable "always overcommit" mode, which can help you load the 3.63GiB npy file with
numpy
:..即使您在神经网络上工作,您也可以尝试将其保存为float32,您将以这种方式减少字节足迹。
链接到Python指南
https://docs.python.org/3/howto/3/howto/howto/howto/functional.html#发电机
Kaggle笔记本使用发电机
https://www.kaggle.com/code/vboodshelf/python-generators-to-reduce-ram-usage-part-part-part-part-2/notebook
您可以尽我所能构建一个建议系统看 ....
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.astype.html ..even if you were working on a neural network you would try to save as float32, you will reduce your byte footprint in this way.
links to Python guide
https://docs.python.org/3/howto/functional.html#generators
Kaggle notebook using generators
https://www.kaggle.com/code/vbookshelf/python-generators-to-reduce-ram-usage-part-2/notebook
You are starting to build a recommender system as far I can see ....