AnchorsExplainer

class astrapia.explainers.AnchorsExplainer(data, predict_fn, min_precision=0.9)

Implementation of the Anchors Explainer onto the base Explainer class

__init__(data, predict_fn, min_precision=0.9)

Initializes an Anchors explainer

Parameters:
  • data – data to be explained

  • predict_fn – prediction function

  • min_precision – minimum precision of the anchor

explain_instance(instance)

Creates an Anchor explanation based on a given instance

Parameters:
  • instance – “Anchor” for explanation

  • instance_set – textual information about subset for metric information

  • threshold – Worst possible precision for the explanation

Returns:

the explanation

inverse_transform_dataset(data: any, meta: Dataset) DataFrame

Inverse transforms the given dataset into a general format to be used by a model or a sampler

Parameters:
  • data – the dataset to inverse transform

  • meta – Dataset object containing metadata

Returns:

the inverse transformed dataset

transform_dataset(data: DataFrame, meta: Dataset) any

Transforms the given dataset into a dataset readable by the explainer

Parameters:
  • data – the dataset to transform

  • meta – Dataset object containing metadata

Returns:

the transformed dataset