Source code for nlp_shap.protocols.value

"""Value function protocol."""

from typing import Protocol

from .backend import GenerationResult


[docs] class ValueFunction(Protocol): """Score coalition utility relative to a base generation.""" @property def name(self) -> str: """Return the registered value-function identifier."""
[docs] def score(self, base: GenerationResult, candidate: GenerationResult) -> float: """Return utility for ``candidate`` relative to ``base``."""