Deploying Orange 3 models

不羁岁月 提交于 2021-02-05 11:35:06

问题


Yes, I've read https://datascience.stackexchange.com/questions/23100/is-there-an-orange-server-to-deploy-the-models-developed-in-orange-3 .

What I mean I do not have to have Orange server (though obviously it would be nice to have it), but rather I would like to deploy the model developed in Orane somehow, e.g. replace an input data file and rerun the model built in Orange from command line to get some predictions out (or import Orange in Python code, load the model and tell it to use new set of data and get prediction out of it, which would be even better).


回答1:


Use the Save Model widget to save the model into a pickle file, which you can then load into Python and use it to classify new data.

Assuming that the model is save to "my_model.pkcls" and your (new) data is in "my_data.tab", do this in Python:

import Orange
import pickle

model = pickle.load(open("my_model.pkcls", "rb"))
data = Orange.data.Table("my_data.tab")
print(model(data))

For other ways to call the model, see the documentation, e.g. here: https://orange-data-mining-library.readthedocs.io/en/latest/tutorial/classification.html#learners-and-classifiers.



来源:https://stackoverflow.com/questions/63060587/deploying-orange-3-models

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!