Runs a point explanation for a given input vector.

Input Parameter

Type

Default

Description

project_id

str

None

The unique identifier for the project.

model_id

str

None

A unique identifier for the model.

dataset_id

str

None

The unique identifier for the dataset.

df

pd.DataFrame

None

A pandas DataFrame containing a model input vector as a row. If more than one row is included, the first row will be used.

explanations

Union [str, list]

'shap'

A string or list of strings specifying which explanation algorithms to run.
Can be one or more of

  • 'fiddler_shapley_values'
  • 'shap'
  • 'ig_flex'
  • 'ig'
  • 'mean_reset'
  • 'zero_reset'
  • 'permute'

casting_type

Optional [bool]

False

If True, will try to cast the data in the events to be in line with the data types defined in the model's ModelInfo object.

return_raw_response

Optional [bool]

False

If True, a raw output will be returned instead of explanation objects.

PROJECT_ID = 'example_project'
DATASET_ID = 'example_dataset'
MODEL_ID = 'example_model'

df = pd.read_csv('example_data.csv')

explanation = client.run_explanation(
    project_id=PROJECT_ID,
    model_id=MODEL_ID,
    dataset_id=DATASET_ID,
    df=df
)

Return Type

Description

Union[fdl.AttributionExplanation, fdl.MulticlassAttributionExplanation, list]

A fdl.AttributionExplanation object, fdl.MulticlassAttributionExplanation object, or list of such objects for each explanation method specified in explanations