trained Model in Python Notebook

arash_fard
Level 1
trained Model in Python Notebook

I'm trying to call a model that was deployed on my flow in a Python Notebook.

The reason is to build a webapp.

to do so, I created a notebook where I generated new data and made a call to the model a follows : 

 

m = dataiku.Model("4bJu8Aug")
my_predictor = m.get_predictor()

 

a new data is df.

my question is, which function I need to call to predict(df)? 


Operating system used: windows

0 Kudos
1 Reply
SarinaS
Dataiker

Hi @arash_fard,

You can get the clf object and then use clf.predictor() like so: 

model = dataiku.Model('9pPIVJO4')
p = model.get_predictor()
clf = p._clf

clf.predict(X_test)


Just in case it's useful as well, if you are curious about a fuller example, you can click on Actions > Export to Jupyter notebook from your visual model to see more detailed steps. 

Let me know if this is not what you are looking for. 

Thank you,
Sarina 

0 Kudos