Source code for secml.explanation.c_explainer

.. module:: CExplainer
   :synopsis: Abstract interface for Explainable ML methods.

.. moduleauthor:: Marco Melis <>
.. moduleauthor:: Ambra Demontis <>

from abc import ABCMeta, abstractmethod

from secml.core import CCreator

[docs]class CExplainer(CCreator, metaclass=ABCMeta): """Abstract interface for Explainable ML methods. Parameters ---------- clf : CClassifier Instance of the classifier to explain. """ __super__ = 'CExplainer' def __init__(self, clf): self._clf = clf @property def clf(self): """Classifier to explain.""" return self._clf
[docs] @abstractmethod def explain(self, x, *args, **kwargs): """Computes the explanation on x.""" raise NotImplementedError