Spaces:
Running
Running
Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Table Markdown Metrics
|
3 |
+
emoji: 📊
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: red
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.19.1
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
tags:
|
11 |
+
- evaluate
|
12 |
+
- metric
|
13 |
+
- table
|
14 |
+
- markdown
|
15 |
+
description: >-
|
16 |
+
Table evaluation metrics for assessing the matching degree between predicted and reference tables.
|
17 |
+
It calculates precision, recall, and F1 score for table data extraction or generation tasks.
|
18 |
+
---
|
19 |
+
|
20 |
+
# Metric Card for Table Markdown Metrics
|
21 |
+
|
22 |
+
## Metric Description
|
23 |
+
|
24 |
+
This metric evaluates the accuracy of table data extraction or generation by comparing predicted tables with reference tables. It calculates:
|
25 |
+
|
26 |
+
1. Precision: The ratio of correctly predicted cells to the total number of cells in the predicted table
|
27 |
+
2. Recall: The ratio of correctly predicted cells to the total number of cells in the reference table
|
28 |
+
3. F1 Score: The harmonic mean of precision and recall
|
29 |
+
|
30 |
+
## How to Use
|
31 |
+
|
32 |
+
This metric requires predictions and references as inputs in Markdown table format.
|
33 |
+
|
34 |
+
```python
|
35 |
+
>>> table_metric = evaluate.load("table_markdown")
|
36 |
+
>>> results = table_metric.compute(
|
37 |
+
... predictions="| | lobby | search | band | charge | chain ||--|--|--|--|--|--|| desire | 5 | 8 | 7 | 5 | 9 || wage | 1 | 5 | 3 | 8 | 5 |",
|
38 |
+
... references="| | lobby | search | band | charge | chain ||--|--|--|--|--|--|| desire | 1 | 6 | 7 | 5 | 9 || wage | 1 | 5 | 2 | 8 | 5 |"
|
39 |
+
... )
|
40 |
+
>>> print(results)
|
41 |
+
{'precision': 0.7, 'recall': 0.7, 'f1': 0.7, 'true_positives': 7, 'false_positives': 3, 'false_negatives': 3}
|
42 |
+
```
|
43 |
+
|
44 |
+
### Inputs
|
45 |
+
- **predictions** (`str`): Predicted table in Markdown format.
|
46 |
+
- **references** (`str`): Reference table in Markdown format.
|
47 |
+
|
48 |
+
### Output Values
|
49 |
+
- **precision** (`float`): Precision score. Range: [0,1]
|
50 |
+
- **recall** (`float`): Recall score. Range: [0,1]
|
51 |
+
- **f1** (`float`): F1 score. Range: [0,1]
|
52 |
+
- **true_positives** (`int`): Number of correctly predicted cells
|
53 |
+
- **false_positives** (`int`): Number of incorrectly predicted cells
|
54 |
+
- **false_negatives** (`int`): Number of cells that were not predicted
|
55 |
+
|
56 |
+
### Examples
|
57 |
+
|
58 |
+
Example - Complex table comparison:
|
59 |
+
```python
|
60 |
+
>>> table_metric = evaluate.load("table_markdown")
|
61 |
+
>>> results = table_metric.compute(
|
62 |
+
... predictions="""
|
63 |
+
... | | lobby | search | band |
|
64 |
+
... |--|-------|--------|------|
|
65 |
+
... | desire | 5 | 8 | 7 |
|
66 |
+
... | wage | 1 | 5 | 3 |
|
67 |
+
... """,
|
68 |
+
... references="""
|
69 |
+
... | | lobby | search | band |
|
70 |
+
... |--|-------|--------|------|
|
71 |
+
... | desire | 5 | 8 | 7 |
|
72 |
+
... | wage | 1 | 5 | 3 |
|
73 |
+
... """
|
74 |
+
... )
|
75 |
+
>>> print(results)
|
76 |
+
{'precision': 1.0, 'recall': 1.0, 'f1': 1.0, 'true_positives': 6, 'false_positives': 0, 'false_negatives': 0}
|
77 |
+
```
|
78 |
+
|
79 |
+
## Limitations and Bias
|
80 |
+
|
81 |
+
1. The metric assumes that tables are well-formed in Markdown format
|
82 |
+
2. The comparison is case-sensitive
|
83 |
+
3. The metric does not handle merged cells or complex table structures
|
84 |
+
4. The metric treats each cell as a separate unit and does not consider the semantic meaning of the content
|
85 |
+
|
86 |
+
## Citation(s)
|
87 |
+
```bibtex
|
88 |
+
@article{scikit-learn,
|
89 |
+
title={Research on Chinese Chart Data Extraction Methods},
|
90 |
+
author={Qiuping Ma,Hangshuo Bi,Qi Zhang,Xiaofan Zhao},
|
91 |
+
journal={None},
|
92 |
+
volume={0},
|
93 |
+
pages={0--0},
|
94 |
+
year={2025}
|
95 |
+
}
|
96 |
+
```
|
97 |
+
|
98 |
+
## Further References
|
99 |
+
|
100 |
+
- [Markdown Tables](https://www.markdownguide.org/extended-syntax/#tables)
|
101 |
+
- [Table Structure Recognition](https://paperswithcode.com/task/table-structure-recognition)
|
102 |
+
- [Table Extraction](https://paperswithcode.com/task/table-extraction)
|