取消沉重的 python 对象返回错误:EOFError Ran out of input Python
我已经制作了一种机器学习算法(RF),并将其保存为泡菜供进一步使用,文件为5GB。当我取消挑剔时,我会得到错误:
reg = pickle.load(f)
EOFError: Ran out of input
这就是我腌制回归的方式(来自Scikit-Learn)
#Pickle
pickle_out = open("D:\\data_for_learning\\Regression.pickle","wb")
pickle.dump(Reg, pickle_out) #REG is from fit(x,y)
pickle_out.close()
,这就是它的挑战:
pickle_file = "D:\\data_for_learning\\RegressionRandom.pickle"
with open(pickle_file, 'rb') as f:
reg = pickle.load(f)
我读到我可以意外地覆盖我的数据,但我只运行了一次,并试图尝试按照我写的方式取消挑选它。我可以再次重新运行机器学习部分,但我想知道问题的根源,为什么?我弄乱了腌制吗?
I have made a machine learning algorithm (RF) and saved it as a pickle for further use and the file is 5gb. When I unpickle it I get the error :
reg = pickle.load(f)
EOFError: Ran out of input
This is how I pickled the regression (from scikit-learn)
#Pickle
pickle_out = open("D:\\data_for_learning\\Regression.pickle","wb")
pickle.dump(Reg, pickle_out) #REG is from fit(x,y)
pickle_out.close()
And this is how unpickle it:
pickle_file = "D:\\data_for_learning\\RegressionRandom.pickle"
with open(pickle_file, 'rb') as f:
reg = pickle.load(f)
I have read that I could accidentally have overwritten my data but I have run it only once and tried to unpickle it the way I wrote it. I can rerun the machine learning part again but I want to know the source of the problem and why? Did I mess up the pickling?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论