Importing a pickle model in Dataiku
![Zyad](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar21.png)
I have a pickle saved OLS model (statsmodels) developed outside Dataiku. I uploaded it on a folder in dataiku but wasn't able to use it from a jupyter notebook.
I have tried those solutions:
import sklearn model trained outside of Dataiku into Dataiku - Dataiku Community
I have tried this but I wasn't able to use after as a model:
folder = dataiku.Folder("Models")
with folder.get_download_stream('linear_regression.pickle') as f:
model = f.read()
What is Dataiku wrapup library for this situation?
Answers
-
JordanB Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 295 Dataiker
Hi @Zyad
,The correct way to load a pickle file would be to add:
folder = dataiku.Folder("Models") with folder.get_download_stream('linear_regression.pickle') as f: model = pickle.load(f)
Also, add "import pickle" along with other libraries. The pickled model should come from the same version of scikit-learn as the one installed in the Python code env you're using here.
Let me know if you have any questions.
Thanks!
Jordan