peal.explainers.interfaces.ExplainerInterface¶
- class peal.explainers.interfaces.ExplainerInterface[source]¶
Bases:
ABCDuck-typed interface every explainer implements.
Subclasses hold their config in
explainer_configand must overrideexplain_batch; the remaining methods are no-op defaults that explainers without an interactive feedback loop may leave untouched.Methods
Explain one batch of samples.
Collect human feedback for previously created explanations (no-op).
Run the explainer stand-alone (outside of an adaptor).
Visualize interpreted explanations together with their feedback (no-op).
Attributes
- explainer_config: ExplainerConfig¶
- abstract explain_batch(batch, **args)[source]¶
Explain one batch of samples.
- Parameters:
batch (
sequence) – A dataset batch, typically(x, y, ...)tensors.**args – Explainer-specific keyword arguments.
- Raises:
NotImplementedError – Always, in the base class.
- run(oracle_path=None, confounder_oracle_path=None)[source]¶
Run the explainer stand-alone (outside of an adaptor).