lvwerra HF staff commited on
Commit
ea3d399
1 Parent(s): 0bacfec

Update Space (evaluate main: c447fc8e)

Browse files
Files changed (2) hide show
  1. poseval.py +3 -16
  2. requirements.txt +1 -1
poseval.py CHANGED
@@ -13,7 +13,6 @@
13
  # limitations under the License.
14
  """ seqeval metric. """
15
 
16
- from dataclasses import dataclass
17
  from typing import Union
18
 
19
  import datasets
@@ -81,27 +80,14 @@ Examples:
81
  """
82
 
83
 
84
- @dataclass
85
- class PosevalConfig(evaluate.info.Config):
86
-
87
- name: str = "default"
88
-
89
- zero_division: Union[str, int] = "warn"
90
-
91
-
92
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
93
  class Poseval(evaluate.Metric):
94
-
95
- CONFIG_CLASS = PosevalConfig
96
- ALLOWED_CONFIG_NAMES = ["default"]
97
-
98
- def _info(self, config):
99
  return evaluate.MetricInfo(
100
  description=_DESCRIPTION,
101
  citation=_CITATION,
102
  homepage="https://scikit-learn.org",
103
  inputs_description=_KWARGS_DESCRIPTION,
104
- config=config,
105
  features=datasets.Features(
106
  {
107
  "predictions": datasets.Sequence(datasets.Value("string", id="label"), id="sequence"),
@@ -115,12 +101,13 @@ class Poseval(evaluate.Metric):
115
  self,
116
  predictions,
117
  references,
 
118
  ):
119
  report = classification_report(
120
  y_true=[label for ref in references for label in ref],
121
  y_pred=[label for pred in predictions for label in pred],
122
  output_dict=True,
123
- zero_division=self.config.zero_division,
124
  )
125
 
126
  return report
 
13
  # limitations under the License.
14
  """ seqeval metric. """
15
 
 
16
  from typing import Union
17
 
18
  import datasets
 
80
  """
81
 
82
 
 
 
 
 
 
 
 
 
83
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
84
  class Poseval(evaluate.Metric):
85
+ def _info(self):
 
 
 
 
86
  return evaluate.MetricInfo(
87
  description=_DESCRIPTION,
88
  citation=_CITATION,
89
  homepage="https://scikit-learn.org",
90
  inputs_description=_KWARGS_DESCRIPTION,
 
91
  features=datasets.Features(
92
  {
93
  "predictions": datasets.Sequence(datasets.Value("string", id="label"), id="sequence"),
 
101
  self,
102
  predictions,
103
  references,
104
+ zero_division: Union[str, int] = "warn",
105
  ):
106
  report = classification_report(
107
  y_true=[label for ref in references for label in ref],
108
  y_pred=[label for pred in predictions for label in pred],
109
  output_dict=True,
110
+ zero_division=zero_division,
111
  )
112
 
113
  return report
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- git+https://github.com/huggingface/evaluate@e4a2724377909fe2aeb4357e3971e5a569673b39
2
  scikit-learn
 
1
+ git+https://github.com/huggingface/evaluate@c447fc8eda9c62af501bfdc6988919571050d950
2
  scikit-learn