Is it possible to extract the trained model object in dataiku and use it in python recipe?

minliang1215
minliang1215 Registered Posts: 4 ✭✭✭✭
In sklearn, we can dump the trained model object to a pickle object, and use it in other parts of the code after loading it. Is there an equivalent function in Dataiku? The only available actions I can see when I click on a trained model are predicting, scoring, evaluation and convert the training process to python code.

Thanks!

Answers

  • UserBird
    UserBird Dataiker, Alpha Tester Posts: 535 Dataiker

    Hi,

    Using the Dataiku API, you can retrieve the model and use it inside a python recipe.

    Something like this will work:

    import dataiku

    m = dataiku.Model(my_model_id)

    my_predictor = m.get_predictor()

    The predictor is a DSS object that allows you to apply the same pipeline as the visual model (preprocessing + scoring). If you want to retrieve the scikit-learn model itself, just add one more line:

    my_clf = my_predictor.clf

    You can find more information here: https://doc.dataiku.com/dss/latest/api/python/saved_models.html

    Cheers,

    Du

Setup Info
    Tags
      Help me…