cancel
Showing results for 
Search instead for 
Did you mean: 

Error When calling PredictionExplanations.create

dd
Image Sensor

Error When calling PredictionExplanations.create

 

dataset_from_path = project.upload_dataset(scenario3_df)
model.get_or_request_feature_impact()
pei = dr.PredictionExplanationsInitialization.create(project_id, model_id)

#Wait for results of Prediction Explanations
pei.get_result_when_complete()

pe_job = dr.PredictionExplanations.create(project_id, model_id, dataset_from_path.id)

#Waiting for Job to Complete
pe = pe_job.get_result_when_complete()

df_pe = pe.get_all_as_dataframe()

 

In spite of using this code with no issue to get Prediction Explanation, and making sure not to use model trained on all the data, I'm now getting the following error

 

ClientError: 422 client error: {'message': 'Predictions must first be generated for this dataset'}

 

I know, from reading community threads, someone had this same issue,  but the solution required DataRobot engineers.
Any help will be appreciated

Labels (3)
0 Kudos
1 Solution

Accepted Solutions
MarkR
Data Scientist
Data Scientist

You also will have to do model.request_predictions before your request for Prediction Explanations. I think you can update your script as follows: 

 

# existing script ...
pei.get_results_when_complete()

predict_job
= model.request_predictions(dataset_from_path.id predict_job.wait_for_completion()

pe_job = dr.PredictionExplanations.create(project_id, model_id, dataset_from_path.id)
# existing script ...

 

Here's a link to some more example scripts in the docs: https://datarobot-public-api-client.readthedocs-hosted.com/en/latest-release/reference/modeling/insi...

View solution in original post

2 Replies
MarkR
Data Scientist
Data Scientist

You also will have to do model.request_predictions before your request for Prediction Explanations. I think you can update your script as follows: 

 

# existing script ...
pei.get_results_when_complete()

predict_job
= model.request_predictions(dataset_from_path.id predict_job.wait_for_completion()

pe_job = dr.PredictionExplanations.create(project_id, model_id, dataset_from_path.id)
# existing script ...

 

Here's a link to some more example scripts in the docs: https://datarobot-public-api-client.readthedocs-hosted.com/en/latest-release/reference/modeling/insi...

dd
Image Sensor

Thank You!

0 Kudos