Skip to content

Explaination Service User Manual with Alibi Anchors

Introduction

This service lets to generate local explainantions for tabular classification models using the AnchorTabular method of the alibi-explain library. The service is planned to work with scikit-learn interface compatible models and with tabular datasets.

Service Features

  • Generation of rule-based (anchor) interpretable explanations for model predictions.
  • Support for scikit-learn models or compatible with predict method.
  • Customization possibility for explainer behaviour and fit function.
  • Automatic handling of numerical and categorical features, including percentile-based discretization.

Parameters

The service accepts the folloing parameters:

Input and Output

Input

  • Tabular Dataset: must be provided in pandas.DataFrame format or equal.
  • Input Modello: a compatible classificator with scikit-learn interface. It must:

  • implement the .predict() method;

  • return discreet labels (not probability);
  • have the feature_names_in_ attribute (tipically available if trained with a Pandas DataFrame). The model have to be:
  • a scikit-learn classificator (i.e. RandomForestClassifier, LogisticRegression, etc.);
  • a scikit-learn pipeline;
  • a libreries models scikit-learn compatible (i.e. XGBoost, LightGBM, CatBoost) as long as they have teh same interface. The models generated by sklearn training service, already present on the Data Analytics System platform, are surely compatible.

Output

  • Saved Explainer: a model alibi-explain in the Data Analytics System supported format, containing both the trained explainer and model to be eplained.

Use Sample

To use the service, it0s enough to configure the requested parameters and load the needed files using the Data Analytics System interface. Here below a practical example:

Setting Example

  • Dataset di input: credit_default.csv
  • Modello di input: random_forest_credit.pkl (trained with sklearn servizio in the Data Analytics System)
  • Parameters:
{
  "labelCol": "default",
  "disc_perc": "(25,50,75)",
  "direct_args_to_explainer": {
    "batch_size": 100
  },
  "direct_args_to_explainer_fit_function": {
    "beam_size": 10
  }
}

Once you'll configure these elements, it's enough to save and start the BDA application (workflow). The serveice will return a alibi-explain model which it will be possible to generate local prediction explanations.

References