Source code for saliency_metrics.metrics.serializable_result

from abc import abstractmethod
from typing import Any, Protocol, runtime_checkable


[docs]@runtime_checkable class SerializableResult(Protocol): """Final evaluation result that can be serialized to a JSON or yaml file."""
[docs] def add_single_result(self, single_result: Any) -> None: """Add single evaluation result. Args: single_result: The result on a single sample or the result under a single re-training setting. Returns: None """ raise NotImplementedError
[docs] @abstractmethod def dump(self, file_path: str) -> None: """Save the result to a JSON or yaml file. Args: file_path: Output file path. Returns: None """ raise NotImplementedError