Spaces:
Runtime error
Runtime error
Fixed the repr for dataclass
Browse files
utils.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import statistics
|
| 2 |
import sys
|
| 3 |
-
from dataclasses import dataclass
|
| 4 |
from typing import List, Union
|
| 5 |
|
| 6 |
import torch
|
|
@@ -232,6 +232,7 @@ class Scores:
|
|
| 232 |
"""
|
| 233 |
precision: float
|
| 234 |
recall: List[float]
|
|
|
|
| 235 |
|
| 236 |
def __post_init__(self):
|
| 237 |
-
self.f1
|
|
|
|
| 1 |
import statistics
|
| 2 |
import sys
|
| 3 |
+
from dataclasses import dataclass, field
|
| 4 |
from typing import List, Union
|
| 5 |
|
| 6 |
import torch
|
|
|
|
| 232 |
"""
|
| 233 |
precision: float
|
| 234 |
recall: List[float]
|
| 235 |
+
f1: float = field(init=False)
|
| 236 |
|
| 237 |
def __post_init__(self):
|
| 238 |
+
self.f1 = compute_f1(self.precision, statistics.fmean(self.recall))
|