- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我想保存并加载一个合适的随机森林分类器,但出现错误。
forest = RandomForestClassifier(n_estimators = 100, max_features = mf_val)
forest = forest.fit(L1[0:100], L2[0:100])
joblib.dump(forest, 'screening_forest/screening_forest.pkl')
forest2 = joblib.load('screening_forest/screening_forest.pkl')
错误是:
File "C:\Users\mkolarek\Documents\other\TrackerResultAnalysis\ScreeningClassif
ier\ScreeningClassifier.py", line 67, in <module>
forest2 = joblib.load('screening_forest/screening_forest.pkl')
File "C:\Python27\lib\site-packages\sklearn\externals\joblib\numpy_pickle.py",
line 425, in load
obj = unpickler.load()
File "C:\Python27\lib\pickle.py", line 858, in load
dispatch[key](self)
File "C:\Python27\lib\site-packages\sklearn\externals\joblib\numpy_pickle.py",
line 285, in load_build
Unpickler.load_build(self)
File "C:\Python27\lib\pickle.py", line 1217, in load_build
setstate(state)
File "_tree.pyx", line 2280, in sklearn.tree._tree.Tree.__setstate__ (sklearn\
tree\_tree.c:18350)
ValueError: Did not recognise loaded array layout
Press any key to continue . . .
我必须初始化 forest2 还是什么?
最佳答案
我用 cPickle 解决了这个问题:
with open('screening_forest/screening_forest.pickle', 'wb') as f:
cPickle.dump(forest, f)
with open('screening_forest/screening_forest.pickle', 'rb') as f:
forest2 = cPickle.load(f)
但 joblib 解决方案也可能有用。
关于python - 拯救随机森林,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27524939/
我们正在运行 MarkLogic 9.0-11 版本 3 节点集群,并且 MarkLogic 安装在“/var/opt/MarkLogic/”目录中,我们创建了“/var/opt/MarkLogic/
我有一片任意高度的森林,大致像这样: let data = [ { "id": 2, "name": "AAA", "parent_id": null, "short_name": "A" },
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 已关闭 7 年前。 Improve
我有一个巨大的深度字典,代表森林(许多非二叉树),我想处理森林并创建一个包含森林所有可能关系的文本文件,例如给定字典: {'a': {'b': {'c': {}, 'd': {}}, 'g': {}}
在我的 Android 应用程序中,我包含了谷歌地图。现在我想获取有关您周围地区的信息。例如,你是在公园/森林/海滩……所以我基本上想要一个用“水”回答输入坐标 53°33'40.9"N 10°00'
如果我有下表: Member_Key Member_Name col1 Mem1 col2 Mem2 col3 Mem3 col4
继续我的老问题: Writing nested dictionary (forest) of a huge depth to a text file 现在我想把森林遍历写成BFS风格:我有一个巨大的深
我有一个多域环境(事件目录林),例如subdomain1.mydomain.com, subdomain2.mydomain.com 其中 mydomain.com 是根 AD 域 (GC) 和 su
我想知道是否有可能在 Google map 或 Bing Mag 2D/3D map 上恢复地形类型(山脉、森林、水域、平原等...) 。为了根据玩家在现实世界中的位置生成 map !我认为可用 AP
我是一名优秀的程序员,十分优秀!