Calculates feature importance for a model over a specified dataset.

Input ParameterTypeDefaultDescription
project_idstrNoneThe unique identifier for the project.
model_idstrNoneA unique identifier for the model.
dataset_idstrNoneThe unique identifier for the dataset.
dataset_splitsOptional [list]NoneA list of dataset splits taken from the dataset argument of upload_dataset. If specified, feature importance will only be calculated over the provided splits. Otherwise, all splits will be used.
slice_queryOptional [str]NoneA SQL query. If specified, feature importance will only be calculated over the dataset slice specified by the query.
**kwargsNoneAdditional arguments to be passed.
Can be one or more of
- n_inputs
- n_iterations
- n_references
- ci_confidence_level
- impact_not_importance
PROJECT_ID = 'example_project'
MODEL_ID = 'example_model'
DATASET_ID = 'example_dataset'

feature_importance = client.run_feature_importance(
    project_id=PROJECT_ID,
    model_id=MODEL_ID,
    dataset_id=DATASET_ID
)
PROJECT_ID = 'example_project'
MODEL_ID = 'example_model'
DATASET_ID = 'example_dataset'

slice_query = f""" SELECT * FROM "{DATASET_ID}.{MODEL_ID}" WHERE feature_1 < 20.0 LIMIT 100 """

feature_importance = client.run_feature_importance(
    project_id=PROJECT_ID,
    model_id=MODEL_ID,
    dataset_id=DATASET_ID,
    slice_query=slice_query
)
Return TypeDescription
dictA dictionary containing feature importance results.