nbansal commited on
Commit
0377c9d
1 Parent(s): 955a39f

Fixed the repr for dataclass

Browse files
Files changed (1) hide show
  1. utils.py +3 -2
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: float = compute_f1(self.precision, statistics.fmean(self.recall))
 
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))