Spaces:
Runtime error
Runtime error
Ikala-allen
commited on
Commit
•
0c51c37
1
Parent(s):
5ad04af
Update relation_extraction.py
Browse files- relation_extraction.py +5 -5
relation_extraction.py
CHANGED
@@ -123,7 +123,7 @@ class relation_extraction(evaluate.Metric):
|
|
123 |
# TODO: Download external resources if needed
|
124 |
pass
|
125 |
|
126 |
-
def _compute(self, predictions, references, mode,
|
127 |
"""Returns the scores"""
|
128 |
# TODO: Compute the different scores of the module
|
129 |
|
@@ -207,7 +207,7 @@ class relation_extraction(evaluate.Metric):
|
|
207 |
scores["ALL"]["Macro_p"] = np.mean([scores[ent_type]["p"] for ent_type in relation_types])
|
208 |
scores["ALL"]["Macro_r"] = np.mean([scores[ent_type]["r"] for ent_type in relation_types])
|
209 |
|
210 |
-
if
|
211 |
-
return scores
|
212 |
-
|
213 |
-
return scores
|
|
|
123 |
# TODO: Download external resources if needed
|
124 |
pass
|
125 |
|
126 |
+
def _compute(self, predictions, references, mode, show=False, relation_types=[]):
|
127 |
"""Returns the scores"""
|
128 |
# TODO: Compute the different scores of the module
|
129 |
|
|
|
207 |
scores["ALL"]["Macro_p"] = np.mean([scores[ent_type]["p"] for ent_type in relation_types])
|
208 |
scores["ALL"]["Macro_r"] = np.mean([scores[ent_type]["r"] for ent_type in relation_types])
|
209 |
|
210 |
+
if show:
|
211 |
+
return scores
|
212 |
+
|
213 |
+
return scores["ALL"]
|