Check out the first Dataiku 8 Deep Dive focusing on Productivity on October 29th Read More

import sklearn model trained outside of Dataiku into Dataiku

Level 1
import sklearn model trained outside of Dataiku into Dataiku
I trained an sklearn model outside of Dataiku and now want to use the model to make predictions in Dataiku. How would I upload my model.joblib or model.pkl file to Dataiku? I don't know if I should try to upload it as a dataset (this didn't really work for me) or if there is a way to upload a model object.



I would want to simply do something like the following within a python recipe in Dataiku:

##import model.joblib - how to get this into Dataiku?

clf=joblib.load(model.joblib)

X=dataiku.Dataset("X").get_dataframe()

predictions=clf.predict(X)
0 Kudos
1 Reply
Dataiker
Dataiker

Hi, 



So the proper way to do it is to create a Folder in your flow, and then upload your pickle file inside it. You can then, with the dataiku api, access the content of such folder and do joblib.load()



You can find in this link an example of such workflow: http://gallery.dataiku.com/projects/DKU_ADVANCEDML/flow/ 



Concretely, what you should look closely is this python recipe that does exactly what you are looking for: http://gallery.dataiku.com/projects/DKU_ADVANCEDML/recipes/compute_test_scored_scikit/



Cheers,



Du Phan

Labels (1)