peal.explainers.counterfactual_explainer¶
The counterfactual explainer of PEAL and the configs of its baselines.
CounterfactualExplainer implements SCE: a counterfactual is searched by
optimising a generator latent (or the image itself) with gradients of the
predictor - optionally a distilled copy of it - until the target class is
reached, while an L1 anchor, a repaint step and an orthogonality penalty keep
the edit small and, across attempts, diverse. The same class also dispatches to
the re-implemented baselines (ACE, DiME, FastDiME, TIME, DAE distillation and a
perfect-false-counterfactual oracle) through their config classes defined here.
Besides the search, the module clusters the resulting explanations, renders collages, computes the reported sparsity and diversity statistics, and can collect human feedback on the collages through a small Flask GUI.
Functions
Give every entry of an explanations dict one row per counterfactual. |
Classes
This class defines the config of a ACE, DiME or FastDiME explainer. |
|
This class implements the counterfactual explanation method |
|
This class defines the config of the SCE explainer. |
|
This class defines the config of a PerfectFalseCounterfactualConfig. |
|
This class defines the config of the SCE explainer. |
|
This class defines the config of a ACEConfig. |