Announcing the winners & finalists of the Dataiku Frontrunner Awards 2021! Read their inspiring stories

How do I apply a prediction using python

rkrause
Level 1
How do I apply a prediction using python

I have created a machine learning model and deployed it. It is a decision classifier. I used the predict recipe on a data set and received columns of probability for each possible classification plus the final prediction. Good stuff so far.

I'd like to work with the model in a python recipe.  I want to apply the model of my choice to a data set of my choice and receive a result dataframe with the probabilities.

How is this done?  I'm having trouble finding an example.  My current roadblock is this, but I'm not sure it's even the right direction:

m = dataiku.Model('1PUZRzcO') #the id of one of my models
my_predictor = m.get_predictor()

Which gives an error:
ModuleNotFoundError: No module named 'sklearn.neural_network.multilayer_perceptron'

0 Kudos
1 Reply
Clément_Stenac
Dataiker
Dataiker

Hi,

You are on the right path. Your issue is likely that your Python recipe is not using the same code environment as the one that was used to train your model. You should use the same code environment to ensure that you have all the required packages, at the proper versions.

0 Kudos
A banner prompting to get Dataiku DSS