-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Merlin Kallenborn
committed
Feb 21, 2024
1 parent
d043d70
commit 0c3d7a1
Showing
11 changed files
with
196 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from abc import ABC, abstractmethod | ||
from typing import Generic, Iterable | ||
|
||
from intelligence_layer.core import Input, Output | ||
from intelligence_layer.evaluation import Evaluation, Example, ExpectedOutput | ||
from intelligence_layer.evaluation.domain import ( | ||
AggregatedEvaluation, | ||
SuccessfulExampleOutput, | ||
) | ||
|
||
|
||
class AggregationLogic(ABC, Generic[Evaluation, AggregatedEvaluation]): | ||
@abstractmethod | ||
def aggregate(self, evaluations: Iterable[Evaluation]) -> AggregatedEvaluation: | ||
"""`Evaluator`-specific method for aggregating individual `Evaluations` into report-like `Aggregated Evaluation`. | ||
This method is responsible for taking the results of an evaluation run and aggregating all the results. | ||
It should create an `AggregatedEvaluation` class and return it at the end. | ||
Args: | ||
evaluations: The results from running `eval_and_aggregate_runs` with a :class:`Task`. | ||
Returns: | ||
The aggregated results of an evaluation run with a :class:`Dataset`. | ||
""" | ||
... | ||
|
||
|
||
class EvaluationLogic(ABC, Generic[Input, Output, ExpectedOutput, Evaluation]): | ||
@abstractmethod | ||
def do_evaluate( | ||
self, | ||
example: Example[Input, ExpectedOutput], | ||
*output: SuccessfulExampleOutput[Output], | ||
) -> Evaluation: | ||
"""Executes the evaluation for this use-case. | ||
Responsible for comparing the input & expected output of a task to the | ||
actually generated output. | ||
Args: | ||
TODO: find a better way to describe this | ||
example: The data example data whose input was passed to the :class:`Task` to produce the output. | ||
output: Output of the :class:`Task` that shall be evaluated. | ||
Returns: | ||
The metrics that come from the evaluated :class:`Task`. | ||
""" | ||
pass |
Oops, something went wrong.