client.run_explanation

Runs a point explanation for a given input vector.

Input ParameterTypeDefaultDescription
project_idstrNoneThe unique identifier for the project.
model_idstrNoneA unique identifier for the model.
dataset_idstrNoneThe unique identifier for the dataset.
dfpd.DataFrameNoneA pandas DataFrame containing a model input vector as a row. If more than one row is included, the first row will be used.
explanationsUnion [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'
n_permutationOptional[int]NoneNumber of permutations used for fiddler_shapley_values and the permute algorithm. Can be used for both tabular and text data.
By default (None), we use 300 permutations.
n_backgroundOptional[int]NoneNumber of background observations used for fiddler_shapley_values, permute and mean_reset algorithms for tabular data.
By default (None), we use 200.
casting_typeOptional [bool]FalseIf 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_responseOptional [bool]FalseIf 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 TypeDescription
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