Importing a pickle model in Dataiku

Zyad
Zyad Registered Posts: 4

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?

Tagged:

Answers

  • JordanB
    JordanB Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 296 Dataiker
    edited July 17

    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

Setup Info
    Tags
      Help me…