Skip to content

tabular

Tabular explainer abstractions.

TabularExplainer

Bases: BaseExplainer

Explainer for Tabular tasks.

Source code in src/xwhy/explainers/tabular.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class TabularExplainer(BaseExplainer):
    """Explainer for Tabular tasks."""

    def __init__(
        self,
        model: object,
        config: ExplainerConfig | None = None,
    ) -> None:
        """Initialize the explainer."""
        super().__init__(model, config)

    def explain(
        self,
        instance: object,
        **kwargs: object,
    ) -> BaseXWhyResult:
        """Generate an explanation for the given input instance.

        Args:
            instance: The input object to explain.
            **kwargs: Additional explainer-specific options.

        Returns:
            An ``XWhyResult`` containing the explanation output.

        Raises:
            NotImplementedError: Always raised in Phase 1.

        """
        raise NotImplementedError(
            "TabularExplainer.explain to be implemented in later phases."
        )

__init__(model, config=None)

Initialize the explainer.

Source code in src/xwhy/explainers/tabular.py
11
12
13
14
15
16
17
def __init__(
    self,
    model: object,
    config: ExplainerConfig | None = None,
) -> None:
    """Initialize the explainer."""
    super().__init__(model, config)

explain(instance, **kwargs)

Generate an explanation for the given input instance.

Parameters:

Name Type Description Default
instance object

The input object to explain.

required
**kwargs object

Additional explainer-specific options.

{}

Returns:

Type Description
BaseXWhyResult

An XWhyResult containing the explanation output.

Raises:

Type Description
NotImplementedError

Always raised in Phase 1.

Source code in src/xwhy/explainers/tabular.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
def explain(
    self,
    instance: object,
    **kwargs: object,
) -> BaseXWhyResult:
    """Generate an explanation for the given input instance.

    Args:
        instance: The input object to explain.
        **kwargs: Additional explainer-specific options.

    Returns:
        An ``XWhyResult`` containing the explanation output.

    Raises:
        NotImplementedError: Always raised in Phase 1.

    """
    raise NotImplementedError(
        "TabularExplainer.explain to be implemented in later phases."
    )