gpt4 book ai didi

python - 橙色在Python脚本中保存模型

转载 作者:行者123 更新时间:2023-12-02 20:42:42 25 4
gpt4 key购买 nike

我可以使用 GUI 成功使用“保存模型”功能。

https://docs.orange.biolab.si/3/visual-programming/widgets/model/savemodel.html

我正在编写一个 python 程序来运行 Orange 库,并希望在 python 中使用此功能。我搜索了Orange开发者提供的文档

https://docs.orange.biolab.si/3/data-mining-library/_modules/

但没有找到解决我的问题的方法。有谁知道我如何编写 python 脚本来使用此功能,或者是否有资源教我们如何在 Python 中使用不同的 Orange 功能?

最佳答案

只需使用 pickle 转储它。这正是保存模型加载模型小部件所做的,这就是为什么我们没有用于此功能的脚本API。

要保存模型模型,请使用:

import pickle

with open("<filename>", "wb") as f:
pickle.dump(model, f)

并加载它使用:

with open("<filename>", "rb") as f:
model = pickle.load(f)

关于python - 橙色在Python脚本中保存模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45598627/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com