stefan-it commited on
Commit
c47824b
·
verified ·
1 Parent(s): 0e5d934

feat: add notebook for parsing evaluation results

Browse files
Files changed (1) hide show
  1. ParseEvaluations.ipynb +55 -34
ParseEvaluations.ipynb CHANGED
@@ -2,12 +2,13 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 4,
6
  "id": "5cbc726d-b9ed-4a87-8424-780a4db25a36",
7
  "metadata": {},
8
  "outputs": [],
9
  "source": [
10
  "import json\n",
 
11
  "\n",
12
  "from pathlib import Path\n",
13
  "from tabulate import tabulate"
@@ -15,7 +16,7 @@
15
  },
16
  {
17
  "cell_type": "code",
18
- "execution_count": 20,
19
  "id": "dbffdf82-5cb2-485d-9334-6e6fb8cc9c91",
20
  "metadata": {},
21
  "outputs": [
@@ -23,7 +24,7 @@
23
  "name": "stdout",
24
  "output_type": "stream",
25
  "text": [
26
- "{'dbmdz/convbert-base-turkish-cased': 'results-dbmdz-convbert-base-turkish-cased.jsonl', 'dbmdz/electra-base-turkish-mc4-cased-generator': 'results-dbmdz-electra-base-turkish-mc4-cased-generator.jsonl', 'dbmdz/distilbert-base-turkish-cased': 'results-dbmdz-distilbert-base-turkish-cased.jsonl', 'dbmdz/convbert-base-turkish-mc4-uncased': 'results-dbmdz-convbert-base-turkish-mc4-uncased.jsonl', 'dbmdz/bert-base-turkish-cased': 'results-dbmdz-bert-base-turkish-cased.jsonl', 'dbmdz/bert-base-turkish-128k-cased': 'results-dbmdz-bert-base-turkish-128k-cased.jsonl', 'dbmdz/electra-base-turkish-cased-generator': 'results-dbmdz-electra-base-turkish-cased-generator.jsonl', 'dbmdz/electra-base-turkish-mc4-uncased-generator': 'results-dbmdz-electra-base-turkish-mc4-uncased-generator.jsonl', 'dbmdz/convbert-base-turkish-mc4-cased': 'results-dbmdz-convbert-base-turkish-mc4-cased.jsonl', 'dbmdz/bert-base-turkish-128k-uncased': 'results-dbmdz-bert-base-turkish-128k-uncased.jsonl', 'dbmdz/electra-small-turkish-cased-generator': 'results-dbmdz-electra-small-turkish-cased-generator.jsonl', 'dbmdz/bert-base-turkish-uncased': 'results-dbmdz-bert-base-turkish-uncased.jsonl'}\n"
27
  ]
28
  }
29
  ],
@@ -58,7 +59,7 @@
58
  },
59
  {
60
  "cell_type": "code",
61
- "execution_count": 14,
62
  "id": "7170ec01-f0f1-49bb-9beb-7927c3b5b3f7",
63
  "metadata": {},
64
  "outputs": [
@@ -119,7 +120,7 @@
119
  },
120
  {
121
  "cell_type": "code",
122
- "execution_count": 40,
123
  "id": "5c444bbe-93e7-4e85-8560-56bff13e1bb0",
124
  "metadata": {},
125
  "outputs": [
@@ -127,49 +128,69 @@
127
  "name": "stdout",
128
  "output_type": "stream",
129
  "text": [
130
- "['Phenomenon', 'dbmdz/electra-small-turkish-cased-generator', 'dbmdz/electra-base-turkish-cased-generator', 'dbmdz/electra-base-turkish-mc4-cased-generator', 'dbmdz/electra-base-turkish-mc4-uncased-generator', 'dbmdz/bert-base-turkish-cased', 'dbmdz/bert-base-turkish-uncased', 'dbmdz/bert-base-turkish-128k-cased', 'dbmdz/bert-base-turkish-128k-uncased', 'dbmdz/distilbert-base-turkish-cased', 'dbmdz/convbert-base-turkish-cased', 'dbmdz/convbert-base-turkish-mc4-cased', 'dbmdz/convbert-base-turkish-mc4-uncased']\n",
131
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
132
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
133
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
134
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
135
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
136
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
137
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
138
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
139
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
140
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
141
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n",
142
- "[['Anaphor Agreement', 97.7], ['Argument Str. Tran.', 99.1], ['Argument Str. Ditr.', 96.1], ['Binding', 99.0], ['Determiners', 99.3], ['Ellipsis', 87.5], ['Irregular Forms', 99.6], ['Island Effects', 51.2], ['Nominalization', 97.4], ['NPI Licensing', 95.0], ['Passives', 81.3], ['Quantifiers', 98.4], ['Relative Clauses', 98.5], ['Scrambling', 100.0], ['Subject Agreement', 98.8], ['Suspended Affixation', 100.0]]\n"
 
 
 
 
 
 
143
  ]
144
  }
145
  ],
146
  "source": [
147
- "headers = [\"Phenomenon\"] + model_names\n",
148
  "\n",
149
- "print(headers)\n",
150
- "\n",
151
- "table = []\n",
152
  "\n",
153
  "for model_name in model_names:\n",
154
- " phenomenon_accuracy_mapping = {}\n",
155
- " \n",
156
  " with open(model_name_evaluation_filename_mapping[model_name], \"rt\") as f_p:\n",
157
- " \n",
158
  " for line in f_p:\n",
159
  " data = json.loads(line)\n",
160
  "\n",
161
  " current_task_name = data[\"file_name\"]\n",
162
- " current_task_accuracy = round(data[\"accuracy\"], 2)\n",
 
163
  " \n",
164
- " phenomenon_accuracy_mapping[current_task_name] = current_task_accuracy\n",
 
 
 
 
 
 
165
  "\n",
166
- " for data_task_name in data_task_names:\n",
167
- " phenomenon = task_phenomenon_mapping[data_task_name]\n",
168
- " accuracy = phenomenon_accuracy_mapping[data_task_name]\n",
169
- " table.append([phenomenon, accuracy])\n",
170
- " print(current_row)\n",
171
  "\n",
172
- "#print(tabulate(table, headers=headers))"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  ]
174
  }
175
  ],
@@ -189,7 +210,7 @@
189
  "name": "python",
190
  "nbconvert_exporter": "python",
191
  "pygments_lexer": "ipython3",
192
- "version": "3.12.3"
193
  }
194
  },
195
  "nbformat": 4,
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": 1,
6
  "id": "5cbc726d-b9ed-4a87-8424-780a4db25a36",
7
  "metadata": {},
8
  "outputs": [],
9
  "source": [
10
  "import json\n",
11
+ "import numpy as np\n",
12
  "\n",
13
  "from pathlib import Path\n",
14
  "from tabulate import tabulate"
 
16
  },
17
  {
18
  "cell_type": "code",
19
+ "execution_count": 2,
20
  "id": "dbffdf82-5cb2-485d-9334-6e6fb8cc9c91",
21
  "metadata": {},
22
  "outputs": [
 
24
  "name": "stdout",
25
  "output_type": "stream",
26
  "text": [
27
+ "{'dbmdz/distilbert-base-turkish-cased': 'results-dbmdz-distilbert-base-turkish-cased.jsonl', 'dbmdz/convbert-base-turkish-mc4-cased': 'results-dbmdz-convbert-base-turkish-mc4-cased.jsonl', 'dbmdz/bert-base-turkish-uncased': 'results-dbmdz-bert-base-turkish-uncased.jsonl', 'dbmdz/bert-base-turkish-128k-cased': 'results-dbmdz-bert-base-turkish-128k-cased.jsonl', 'dbmdz/bert-base-turkish-cased': 'results-dbmdz-bert-base-turkish-cased.jsonl', 'dbmdz/electra-small-turkish-cased-generator': 'results-dbmdz-electra-small-turkish-cased-generator.jsonl', 'dbmdz/convbert-base-turkish-cased': 'results-dbmdz-convbert-base-turkish-cased.jsonl', 'dbmdz/electra-base-turkish-cased-generator': 'results-dbmdz-electra-base-turkish-cased-generator.jsonl', 'dbmdz/convbert-base-turkish-mc4-uncased': 'results-dbmdz-convbert-base-turkish-mc4-uncased.jsonl', 'dbmdz/electra-base-turkish-mc4-cased-generator': 'results-dbmdz-electra-base-turkish-mc4-cased-generator.jsonl', 'dbmdz/bert-base-turkish-128k-uncased': 'results-dbmdz-bert-base-turkish-128k-uncased.jsonl', 'dbmdz/electra-base-turkish-mc4-uncased-generator': 'results-dbmdz-electra-base-turkish-mc4-uncased-generator.jsonl'}\n"
28
  ]
29
  }
30
  ],
 
59
  },
60
  {
61
  "cell_type": "code",
62
+ "execution_count": 3,
63
  "id": "7170ec01-f0f1-49bb-9beb-7927c3b5b3f7",
64
  "metadata": {},
65
  "outputs": [
 
120
  },
121
  {
122
  "cell_type": "code",
123
+ "execution_count": 4,
124
  "id": "5c444bbe-93e7-4e85-8560-56bff13e1bb0",
125
  "metadata": {},
126
  "outputs": [
 
128
  "name": "stdout",
129
  "output_type": "stream",
130
  "text": [
131
+ "| Phenomenon | [`dbmdz/electra-small-turkish-cased-generator`](https://huggingface.co/dbmdz/electra-small-turkish-cased-generator) | [`dbmdz/electra-base-turkish-cased-generator`](https://huggingface.co/dbmdz/electra-base-turkish-cased-generator) | [`dbmdz/electra-base-turkish-mc4-cased-generator`](https://huggingface.co/dbmdz/electra-base-turkish-mc4-cased-generator) | [`dbmdz/electra-base-turkish-mc4-uncased-generator`](https://huggingface.co/dbmdz/electra-base-turkish-mc4-uncased-generator) | [`dbmdz/bert-base-turkish-cased`](https://huggingface.co/dbmdz/bert-base-turkish-cased) | [`dbmdz/bert-base-turkish-uncased`](https://huggingface.co/dbmdz/bert-base-turkish-uncased) | [`dbmdz/bert-base-turkish-128k-cased`](https://huggingface.co/dbmdz/bert-base-turkish-128k-cased) | [`dbmdz/bert-base-turkish-128k-uncased`](https://huggingface.co/dbmdz/bert-base-turkish-128k-uncased) | [`dbmdz/distilbert-base-turkish-cased`](https://huggingface.co/dbmdz/distilbert-base-turkish-cased) | [`dbmdz/convbert-base-turkish-cased`](https://huggingface.co/dbmdz/convbert-base-turkish-cased) | [`dbmdz/convbert-base-turkish-mc4-cased`](https://huggingface.co/dbmdz/convbert-base-turkish-mc4-cased) | [`dbmdz/convbert-base-turkish-mc4-uncased`](https://huggingface.co/dbmdz/convbert-base-turkish-mc4-uncased) |\n",
132
+ "|----------------------|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|\n",
133
+ "| Anaphor Agreement | 74.1 | 94.3 | 94.3 | 92.8 | 96.7 | 97.3 | 97.3 | 97.7 | 96.9 | 58.1 | 44.3 | 44.6 |\n",
134
+ "| Argument Str. Tran. | 86.6 | 99.6 | 99.4 | 98.7 | 99.7 | 99.6 | 99.8 | 99.1 | 97.5 | 51.9 | 58.1 | 51.3 |\n",
135
+ "| Argument Str. Ditr. | 79.3 | 96.1 | 95.5 | 95.2 | 99.8 | 96.1 | 96.1 | 96.1 | 95.4 | 64.6 | 58.6 | 64.5 |\n",
136
+ "| Binding | 70.7 | 96.2 | 91.4 | 89.6 | 99.9 | 98.5 | 97.7 | 99 | 93 | 89.1 | 49.4 | 78.4 |\n",
137
+ "| Determiners | 91.8 | 99.3 | 98.2 | 99.1 | 99.9 | 100 | 99 | 99.3 | 82.9 | 0 | 0 | 0 |\n",
138
+ "| Ellipsis | 10.6 | 49.7 | 46.3 | 49 | 87.4 | 73.6 | 96.6 | 87.5 | 13.6 | 54.7 | 57.8 | 67.9 |\n",
139
+ "| Irregular Forms | 98.7 | 97.9 | 99 | 99.8 | 98.8 | 100 | 99.9 | 99.6 | 94.1 | 82.9 | 86.6 | 95.2 |\n",
140
+ "| Island Effects | 39.1 | 35.3 | 41.8 | 44 | 49.4 | 39.8 | 60.9 | 51.2 | 47.4 | 96.7 | 99.4 | 100 |\n",
141
+ "| Nominalization | 90 | 96.6 | 97 | 95.4 | 97.4 | 97 | 98.9 | 97.4 | 95.6 | 55.2 | 59.2 | 60.6 |\n",
142
+ "| NPI Licensing | 90.9 | 96.1 | 95 | 98 | 98.2 | 97.6 | 97.2 | 95 | 92.1 | 82.1 | 95.6 | 71.9 |\n",
143
+ "| Passives | 100 | 91.2 | 93.6 | 91.6 | 82.2 | 78.1 | 84.4 | 81.3 | 98.8 | 100 | 100 | 99 |\n",
144
+ "| Quantifiers | 97.9 | 98 | 98 | 97.6 | 95.7 | 94.6 | 98 | 98.4 | 98.4 | 99 | 99 | 99 |\n",
145
+ "| Relative Clauses | 79.9 | 90.7 | 92 | 91.6 | 97.7 | 97.5 | 97 | 98.5 | 92 | 53.4 | 53.7 | 56.9 |\n",
146
+ "| Scrambling | 99.5 | 100 | 100 | 99.8 | 100 | 100 | 99.6 | 100 | 99.8 | 38.7 | 59.3 | 63.3 |\n",
147
+ "| Subject Agreement | 82.8 | 99 | 97.2 | 96.1 | 98.3 | 99.2 | 99.1 | 98.8 | 97 | 47.7 | 43.9 | 56.4 |\n",
148
+ "| Suspended Affixation | 97.5 | 99 | 99.1 | 98.8 | 100 | 100 | 100 | 100 | 100 | 25.4 | 12.8 | 23.2 |\n",
149
+ "| Model Average | 80.6 | 89.9 | 89.9 | 89.8 | 93.8 | 91.8 | 95.1 | 93.7 | 87.2 | 62.5 | 61.1 | 64.5 |\n"
150
  ]
151
  }
152
  ],
153
  "source": [
154
+ "headers = [\"Phenomenon\"] + [f\"[`{model_name}`](https://huggingface.co/{model_name})\" for model_name in model_names]\n",
155
  "\n",
156
+ "model_results = {}\n",
 
 
157
  "\n",
158
  "for model_name in model_names:\n",
159
+ " current_model_results = {}\n",
 
160
  " with open(model_name_evaluation_filename_mapping[model_name], \"rt\") as f_p:\n",
 
161
  " for line in f_p:\n",
162
  " data = json.loads(line)\n",
163
  "\n",
164
  " current_task_name = data[\"file_name\"]\n",
165
+ " current_task_accuracy = round(data[\"accuracy\"], 1)\n",
166
+ " current_task_phenomenon = task_phenomenon_mapping[current_task_name]\n",
167
  " \n",
168
+ " current_model_results[current_task_phenomenon] = current_task_accuracy\n",
169
+ "\n",
170
+ " model_average = list(current_model_results.values())\n",
171
+ " model_average = np.mean(model_average)\n",
172
+ " model_average = round(model_average, 1)\n",
173
+ "\n",
174
+ " current_model_results[\"Model Average\"] = model_average\n",
175
  "\n",
176
+ " model_results[model_name] = current_model_results\n",
 
 
 
 
177
  "\n",
178
+ "table = []\n",
179
+ "\n",
180
+ "phenomenons.append(\"Model Average\")\n",
181
+ "\n",
182
+ "for phenomenon in phenomenons:\n",
183
+ " current_row = []\n",
184
+ "\n",
185
+ " current_row.append(phenomenon)\n",
186
+ "\n",
187
+ " for model_name in model_names:\n",
188
+ " current_phenomenon_accuracy = model_results[model_name][phenomenon]\n",
189
+ " current_row.append(current_phenomenon_accuracy)\n",
190
+ "\n",
191
+ " table.append(current_row)\n",
192
+ " \n",
193
+ "print(tabulate(table, headers=headers, tablefmt=\"github\"))"
194
  ]
195
  }
196
  ],
 
210
  "name": "python",
211
  "nbconvert_exporter": "python",
212
  "pygments_lexer": "ipython3",
213
+ "version": "3.13.3"
214
  }
215
  },
216
  "nbformat": 4,