John Graham Reynolds commited on
Commit
217c111
·
1 Parent(s): 9b29e93

update pandas indexing

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -11,7 +11,7 @@ description = """<p style='text-align: center'>
11
  As I introduce myself to the entirety of the 🤗 ecosystem, I've put together this Space to show off a temporary fix for a current 🪲 in the 🤗 Evaluate library. \n
12
 
13
  Check out the original, longstanding issue [here](https://github.com/huggingface/evaluate/issues/234). This details how it is currently impossible to \
14
- 'evaluate.combine()' multiple metrics related to multilabel text classification. Particularly, one cannot 'combine()' the f1, precision, and recall scores for \
15
  evaluation. I encountered this issue specifically while training [RoBERTa-base-DReiFT](https://huggingface.co/MarioBarbeque/RoBERTa-base-DReiFT) for multilabel \
16
  text classification of 805 labeled medical conditions based on drug reviews. \n
17
 
@@ -24,9 +24,9 @@ trained [multilabel text classification model](https://github.com/johngrahamreyn
24
 
25
  def evaluation(predictions, metrics) -> str:
26
 
27
- f1 = FixedF1(average=metrics["f1"])
28
- precision = FixedPrecision(average=metrics["precision"])
29
- recall = FixedRecall(average=metrics["recall"])
30
  combined = evaluate.combine([f1, recall, precision])
31
 
32
  df = predictions.get_dataframe()
 
11
  As I introduce myself to the entirety of the 🤗 ecosystem, I've put together this Space to show off a temporary fix for a current 🪲 in the 🤗 Evaluate library. \n
12
 
13
  Check out the original, longstanding issue [here](https://github.com/huggingface/evaluate/issues/234). This details how it is currently impossible to \
14
+ `evaluate.combine()` multiple metrics related to multilabel text classification. Particularly, one cannot `combine` the `f1`, `precision`, and `recall` scores for \
15
  evaluation. I encountered this issue specifically while training [RoBERTa-base-DReiFT](https://huggingface.co/MarioBarbeque/RoBERTa-base-DReiFT) for multilabel \
16
  text classification of 805 labeled medical conditions based on drug reviews. \n
17
 
 
24
 
25
  def evaluation(predictions, metrics) -> str:
26
 
27
+ f1 = FixedF1(average=metrics.loc[metrics["Metric"] == "f1"]["Averaging Type"][0])
28
+ precision = FixedPrecision(average=metrics.loc[metrics["Metric"] == "precision"]["Averaging Type"][0])
29
+ recall = FixedRecall(average=metrics.loc[metrics["Metric"] == "recall"]["Averaging Type"][0])
30
  combined = evaluate.combine([f1, recall, precision])
31
 
32
  df = predictions.get_dataframe()