Upload metric_utils.py with huggingface_hub
Browse files- metric_utils.py +4 -4
metric_utils.py
CHANGED
@@ -6,7 +6,7 @@ from datasets import Features, Value
|
|
6 |
from .dataclass import Dataclass
|
7 |
from .operator import (
|
8 |
MultiStreamOperator,
|
9 |
-
|
10 |
StreamInitializerOperator,
|
11 |
)
|
12 |
from .operators import (
|
@@ -24,7 +24,7 @@ from .stream import MultiStream, Stream
|
|
24 |
|
25 |
|
26 |
class MultiStreamScoreMean(MultiStreamOperator):
|
27 |
-
def
|
28 |
scores = []
|
29 |
for stream in multi_stream.values():
|
30 |
instance = stream.peek()
|
@@ -58,7 +58,7 @@ class MultiStreamScoreMean(MultiStreamOperator):
|
|
58 |
)
|
59 |
return MultiStream(result)
|
60 |
|
61 |
-
mean_score = self.
|
62 |
result = {}
|
63 |
for stream_name, stream in multi_stream.items():
|
64 |
result[stream_name] = Stream(
|
@@ -92,7 +92,7 @@ class FromPredictionsAndOriginalData(StreamInitializerOperator):
|
|
92 |
# lists, and are converted to a dictionary.
|
93 |
|
94 |
|
95 |
-
class MetricRecipe(
|
96 |
calc_confidence_intervals: bool = True
|
97 |
|
98 |
def prepare(self):
|
|
|
6 |
from .dataclass import Dataclass
|
7 |
from .operator import (
|
8 |
MultiStreamOperator,
|
9 |
+
SequentialOperatorInitializer,
|
10 |
StreamInitializerOperator,
|
11 |
)
|
12 |
from .operators import (
|
|
|
24 |
|
25 |
|
26 |
class MultiStreamScoreMean(MultiStreamOperator):
|
27 |
+
def aggregate_results(self, multi_stream: MultiStream):
|
28 |
scores = []
|
29 |
for stream in multi_stream.values():
|
30 |
instance = stream.peek()
|
|
|
58 |
)
|
59 |
return MultiStream(result)
|
60 |
|
61 |
+
mean_score = self.aggregate_results(multi_stream)
|
62 |
result = {}
|
63 |
for stream_name, stream in multi_stream.items():
|
64 |
result[stream_name] = Stream(
|
|
|
92 |
# lists, and are converted to a dictionary.
|
93 |
|
94 |
|
95 |
+
class MetricRecipe(SequentialOperatorInitializer):
|
96 |
calc_confidence_intervals: bool = True
|
97 |
|
98 |
def prepare(self):
|