Source code for nlp_shap.protocols.renderer

"""Attribution renderer protocol."""

from collections.abc import Sequence
from typing import Any, Protocol

from ..domain.estimands import Estimand


[docs] class AttributionRenderer(Protocol): """Render per-player attribution values for human review.""" @property def name(self) -> str: """Return the registered renderer identifier."""
[docs] def render( self, labels: Sequence[str], values: Sequence[float], *, estimand: Estimand, title: str | None = None, ) -> Any: """Return a visualization artifact for the given labels and values."""