Importing a pickle model in Dataiku

Tags
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?

Answers

  • Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 297 Dataiker
    edited July 2024

    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

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.