<filename>ote_sdk/ote_sdk/usecases/tasks/interfaces/evaluate_interface.py<gh_stars>100-1000
"""This module contains the interface class for tasks that can compute performance. """


# Copyright (C) 2021-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

import abc
from typing import Optional

from ote_sdk.entities.resultset import ResultSetEntity


class IEvaluationTask(metaclass=abc.ABCMeta):
    """
    A base interface class for tasks which can compute performance on a resultset.
    """

    @abc.abstractmethod
    def evaluate(
        self, output_resultset: ResultSetEntity, evaluation_metric: Optional[str] = None
    ):
        """
        Compute performance metrics for a given set of results.
        The task may use at its discretion the most appropriate metrics for the evaluation (for instance,
        average precision for classification, DICE for segmentation, etc).
        The performance will be stored directly to output_resultset.performance

        :param output_resultset: The set of results which must be evaluated.
        :param evaluation_metric: the evaluation metric used to compute the performance
        """
        raise NotImplementedError
