base.py 718 B

1234567891011121314151617181920212223242526272829
  1. from abc import ABC, abstractmethod
  2. from embedchain.utils.eval import EvalData
  3. class BaseMetric(ABC):
  4. """Base class for a metric.
  5. This class provides a common interface for all metrics.
  6. """
  7. def __init__(self, name: str = "base_metric"):
  8. """
  9. Initialize the BaseMetric.
  10. """
  11. self.name = name
  12. @abstractmethod
  13. def evaluate(self, dataset: list[EvalData]):
  14. """
  15. Abstract method to evaluate the dataset.
  16. This method should be implemented by subclasses to perform the actual
  17. evaluation on the dataset.
  18. :param dataset: dataset to evaluate
  19. :type dataset: list[EvalData]
  20. """
  21. raise NotImplementedError()