lhy commited on
Commit
eaa6007
1 Parent(s): 0f31f86
Files changed (3) hide show
  1. README.md +1 -1
  2. ranking_loss.py +2 -3
  3. requirements.txt +2 -1
README.md CHANGED
@@ -1,7 +1,7 @@
1
  ---
2
  title: Ranking Loss
3
  datasets:
4
- -
5
  tags:
6
  - evaluate
7
  - metric
 
1
  ---
2
  title: Ranking Loss
3
  datasets:
4
+ - "custom"
5
  tags:
6
  - evaluate
7
  - metric
ranking_loss.py CHANGED
@@ -15,7 +15,7 @@
15
 
16
  import evaluate
17
  import datasets
18
-
19
 
20
  # TODO: Add BibTeX citation
21
  _CITATION = """\
@@ -89,7 +89,6 @@ class RankingLoss(evaluate.Metric):
89
  def _compute(self, predictions, references):
90
  """Returns the scores"""
91
  # TODO: Compute the different scores of the module
92
- accuracy = sum(i == j for i, j in zip(predictions, references)) / len(predictions)
93
  return {
94
- "accuracy": accuracy,
95
  }
 
15
 
16
  import evaluate
17
  import datasets
18
+ from sklearn.metrics import label_ranking_loss
19
 
20
  # TODO: Add BibTeX citation
21
  _CITATION = """\
 
89
  def _compute(self, predictions, references):
90
  """Returns the scores"""
91
  # TODO: Compute the different scores of the module
 
92
  return {
93
+ "ranking_loss": label_ranking_loss(references, predictions),
94
  }
requirements.txt CHANGED
@@ -1 +1,2 @@
1
- git+https://github.com/huggingface/evaluate@main
 
 
1
+ git+https://github.com/huggingface/evaluate@main
2
+ scikit-learn