Coming soon: We’re working on a brand new, revamped Community experience. Want to receive updates? Sign up now!

0 votes

I want to automatically consume the data on the "Variable Importance"  area under the "Interpretation" section of a trained model.  I see that I can manually export this data, but what I am trying to do is to get this data in a dataset or something similar where I can build pipelines on top of it.  

Is that possible?

1 Answer

+1 vote


Please find below a piece of code to retrieve variable importance raw data for a trained model in an Analysis:

import dataiku
import pandas as pd

client = dataiku.api_client()
project = client.get_project(dataiku.default_project_key())
analysis = project.get_analysis("rGRd5qWg")
ml_task = analysis.get_ml_task("fm97lWNq")
trained_model_ids = ml_task.get_trained_models_ids()

trained_model_detail = ml_task.get_trained_model_details(trained_model_ids[0])
feature_importance = trained_model_detail.get_raw().get("iperf").get("rawImportance")
feature_importance_df = pd.DataFrame(feature_importance)

Note that you can get the analysis_id, ml_task_id and trained_model_id from the URL of the page of the model. Or you can get that using our API:

Hope it helps,


This is awesome!!.  Thanks!.
1,339 questions
1,365 answers
11,916 users

©Dataiku 2012-2018 - Privacy Policy