Skip to content

Prediction Service User Manual with Alibi Anchors

Introduction

This service will let you to generate the prodictions explained for sigle observations using a previously trained model with AnchorTabular method from alibi-explain library. The service is though up to operate only in combination with a compatible traning service of the Data Analytics System platform, producing models in a supported format.

Service Features

  • Make a prediction for one or more input rows.
  • Generate loca explanations in form of anchors (rules).
  • Support the customization of Alibi method explain() parameters.
  • Manage the model recovery, explainer recovery and input strategies recovery.

Parameters

  • --direct_args_to_explainer_function: JSON dictonary with methos parameters .explain() of the explainer. For complete details on accepted parameters, please check the official documentation: AnchorTabular.explain

Input and Output

Input

  • Input Model: it must be a trained model with a Data Analytics System traning service based on AnchorTabular. The format dictate the model contains also the explainer and the informazions for the input.
  • Dataset: it can contain one or more observations (rows), as long as it is provided as "streaming" dataset type in JSON format dictionary or a list of dictionaries.

Output

  • The output message contains the origin input added with predictions field including:

  • "name" (target class),

  • "value" (model prediction),
  • "explanation" (anchoref rule in text format).

Use Case Sample

Input Example (one row):

{
  "age": 45,
  "job": "technician",
  "marital": "married",
  "education": "secondary",
  "balance": 1234
}

Parameters:

{
  "direct_args_to_explainer_function": {
    "threshold": 0.8,
    "beam_size": 10
  }
}

Output:

{
  "age": 45,
  "job": "technician",
  "marital": "married",
  "education": "secondary",
  "balance": 1234,
  "predictions": [
    {
      "name": "predicted_label",
      "value": 1,
      "explanation": "IF job = technician AND education = secondary THEN prediction = 1"
    }
  ]
}

Important Notes

  • This service is not indipendent: it needs models build with alibi-explain-anchors training service available on Data Analytics System platform.
  • If model requested features are missing, they will be added and input as automatically.
  • The input dataset have to be streaming type.

References