lvwerra HF staff commited on
Commit
cad53cb
·
1 Parent(s): 90a0b97

Update Space (evaluate main: c447fc8e)

Browse files
Files changed (2) hide show
  1. matthews_correlation.py +3 -21
  2. requirements.txt +1 -1
matthews_correlation.py CHANGED
@@ -13,9 +13,6 @@
13
  # limitations under the License.
14
  """Matthews Correlation metric."""
15
 
16
- from dataclasses import dataclass
17
- from typing import List, Optional
18
-
19
  import datasets
20
  from sklearn.metrics import matthews_corrcoef
21
 
@@ -82,26 +79,13 @@ _CITATION = """\
82
  """
83
 
84
 
85
- @dataclass
86
- class MatthewsCorrelationConfig(evaluate.info.Config):
87
-
88
- name: str = "default"
89
-
90
- sample_weight: Optional[List] = None
91
-
92
-
93
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
94
  class MatthewsCorrelation(evaluate.Metric):
95
-
96
- CONFIG_CLASS = MatthewsCorrelationConfig
97
- ALLOWED_CONFIG_NAMES = ["default"]
98
-
99
- def _info(self, config):
100
  return evaluate.MetricInfo(
101
  description=_DESCRIPTION,
102
  citation=_CITATION,
103
  inputs_description=_KWARGS_DESCRIPTION,
104
- config=config,
105
  features=datasets.Features(
106
  {
107
  "predictions": datasets.Value("int32"),
@@ -113,9 +97,7 @@ class MatthewsCorrelation(evaluate.Metric):
113
  ],
114
  )
115
 
116
- def _compute(self, predictions, references):
117
  return {
118
- "matthews_correlation": float(
119
- matthews_corrcoef(references, predictions, sample_weight=self.config.sample_weight)
120
- ),
121
  }
 
13
  # limitations under the License.
14
  """Matthews Correlation metric."""
15
 
 
 
 
16
  import datasets
17
  from sklearn.metrics import matthews_corrcoef
18
 
 
79
  """
80
 
81
 
 
 
 
 
 
 
 
 
82
  @evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
83
  class MatthewsCorrelation(evaluate.Metric):
84
+ def _info(self):
 
 
 
 
85
  return evaluate.MetricInfo(
86
  description=_DESCRIPTION,
87
  citation=_CITATION,
88
  inputs_description=_KWARGS_DESCRIPTION,
 
89
  features=datasets.Features(
90
  {
91
  "predictions": datasets.Value("int32"),
 
97
  ],
98
  )
99
 
100
+ def _compute(self, predictions, references, sample_weight=None):
101
  return {
102
+ "matthews_correlation": float(matthews_corrcoef(references, predictions, sample_weight=sample_weight)),
 
 
103
  }
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- git+https://github.com/huggingface/evaluate@e4a2724377909fe2aeb4357e3971e5a569673b39
2
  sklearn
 
1
+ git+https://github.com/huggingface/evaluate@c447fc8eda9c62af501bfdc6988919571050d950
2
  sklearn