Spaces:
Runtime error
Runtime error
Commit
·
6e27aba
1
Parent(s):
23dcd87
Update readme for how to use
Browse files
README.md
CHANGED
@@ -23,6 +23,7 @@ pinned: false
|
|
23 |
*Give general statement of how to use the metric*
|
24 |
|
25 |
*Provide simplest possible example for using the metric*
|
|
|
26 |
```python
|
27 |
import evaluate
|
28 |
|
@@ -37,6 +38,7 @@ valid_labels = [
|
|
37 |
"/推薦/其他",
|
38 |
""
|
39 |
]
|
|
|
40 |
predictions = [
|
41 |
["/開箱/xxx", "/教學/yyy", "/表達/zzz"],
|
42 |
["/分享/外部資訊/aaa", "/教學/yyy", "/表達/zzz", "/分享/個人資訊/bbb"]
|
@@ -45,11 +47,16 @@ references = [
|
|
45 |
["/開箱/xxx", "/教學/yyy", "/表達/zzz"],
|
46 |
["/推薦/產品/bbb", "/教學/yyy", "/表達/zzz"]
|
47 |
]
|
|
|
48 |
metric = evaluate.load("DarrenChensformer/action_generation")
|
49 |
result = metric.compute(predictions=predictions, references=references, valid_labels=valid_labels, detailed_scores=True)
|
50 |
print(result)
|
51 |
```
|
52 |
|
|
|
|
|
|
|
|
|
53 |
### Inputs
|
54 |
*List all input arguments in the format below*
|
55 |
- **input_field** *(type): Definition of input, with explanation if necessary. State any default value(s).*
|
|
|
23 |
*Give general statement of how to use the metric*
|
24 |
|
25 |
*Provide simplest possible example for using the metric*
|
26 |
+
|
27 |
```python
|
28 |
import evaluate
|
29 |
|
|
|
38 |
"/推薦/其他",
|
39 |
""
|
40 |
]
|
41 |
+
|
42 |
predictions = [
|
43 |
["/開箱/xxx", "/教學/yyy", "/表達/zzz"],
|
44 |
["/分享/外部資訊/aaa", "/教學/yyy", "/表達/zzz", "/分享/個人資訊/bbb"]
|
|
|
47 |
["/開箱/xxx", "/教學/yyy", "/表達/zzz"],
|
48 |
["/推薦/產品/bbb", "/教學/yyy", "/表達/zzz"]
|
49 |
]
|
50 |
+
|
51 |
metric = evaluate.load("DarrenChensformer/action_generation")
|
52 |
result = metric.compute(predictions=predictions, references=references, valid_labels=valid_labels, detailed_scores=True)
|
53 |
print(result)
|
54 |
```
|
55 |
|
56 |
+
```
|
57 |
+
{'class': {'precision': 0.7143, 'recall': 0.8333, 'f1': 0.7692}, 'phrase': {'precision': 0.8571, 'recall': 1.0, 'f1': 0.9231}, 'weighted_sum': {'precision': 0.7429, 'recall': 0.8666, 'f1': 0.8}}
|
58 |
+
```
|
59 |
+
|
60 |
### Inputs
|
61 |
*List all input arguments in the format below*
|
62 |
- **input_field** *(type): Definition of input, with explanation if necessary. State any default value(s).*
|