Skip to content

Commit

Permalink
restored explanationresults class
Browse files Browse the repository at this point in the history
  • Loading branch information
RobGeada committed Dec 13, 2022
1 parent d4ba07a commit 9f57f9b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/trustyai/explainers/counterfactuals.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import matplotlib.pyplot as plt
import matplotlib as mpl
import pandas as pd
from pandas.io.formats.style import Styler # pylint: disable=unused-import
import uuid as _uuid

from trustyai import _default_initializer # pylint: disable=unused-import
Expand All @@ -20,6 +19,8 @@
Model,
)

from .explanation_results import ExplanationResults


from trustyai.utils.data_conversions import (
prediction_object_to_numpy,
Expand Down Expand Up @@ -50,7 +51,7 @@
CounterfactualConfig = _CounterfactualConfig


class CounterfactualResult:
class CounterfactualResult(ExplanationResults):
"""Wraps Counterfactual results. This object is returned by the
:class:`~CounterfactualExplainer`, and provides a variety of methods to visualize and interact
with the results of the counterfactual explanation.
Expand Down
13 changes: 13 additions & 0 deletions src/trustyai/explainers/explanation_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
from pandas.io.formats.style import Styler


# pylint: disable=too-few-public-methods
class ExplanationResults(ABC):
"""Abstract class for non-saliency visualisers"""

@abstractmethod
def as_dataframe(self) -> pd.DataFrame:
"""Display explanation result as a dataframe"""

@abstractmethod
def as_html(self) -> Styler:
"""Visualise the styled dataframe"""


# pylint: disable=too-few-public-methods
class SaliencyResults(ABC):
"""Abstract class for saliency visualisers"""
Expand Down

0 comments on commit 9f57f9b

Please sign in to comment.