Upload metrics.py with huggingface_hub
Browse files- metrics.py +3 -3
metrics.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from abc import ABC, abstractmethod
|
2 |
from dataclasses import dataclass, field
|
3 |
-
from typing import Any, Dict, List
|
4 |
|
5 |
from .operator import SingleStreamOperator, StreamInstanceOperator
|
6 |
from .stream import Stream
|
@@ -21,7 +21,7 @@ class UpdateStream(StreamInstanceOperator):
|
|
21 |
instance.update(self.update)
|
22 |
return instance
|
23 |
|
24 |
-
|
25 |
class Metric(ABC):
|
26 |
@property
|
27 |
@abstractmethod
|
@@ -78,7 +78,7 @@ class InstanceMetric(SingleStreamOperator, Metric):
|
|
78 |
def reduction_map(self) -> dict:
|
79 |
pass
|
80 |
|
81 |
-
def process(self, stream: Stream):
|
82 |
global_score = {}
|
83 |
instances = []
|
84 |
|
|
|
1 |
from abc import ABC, abstractmethod
|
2 |
from dataclasses import dataclass, field
|
3 |
+
from typing import Any, Dict, List, Generator
|
4 |
|
5 |
from .operator import SingleStreamOperator, StreamInstanceOperator
|
6 |
from .stream import Stream
|
|
|
21 |
instance.update(self.update)
|
22 |
return instance
|
23 |
|
24 |
+
# TODO: currently we have two classes with this name. metric.Metric and matrics.Metric...
|
25 |
class Metric(ABC):
|
26 |
@property
|
27 |
@abstractmethod
|
|
|
78 |
def reduction_map(self) -> dict:
|
79 |
pass
|
80 |
|
81 |
+
def process(self, stream: Stream, stream_name: str = None) -> Generator:
|
82 |
global_score = {}
|
83 |
instances = []
|
84 |
|