David Pomerenke
commited on
Commit
·
4106f13
1
Parent(s):
ce2acb0
Refactor score columns
Browse files
frontend/src/components/LanguageTable.js
CHANGED
@@ -4,7 +4,7 @@ import { FilterMatchMode } from 'primereact/api'
|
|
4 |
import { MultiSelect } from 'primereact/multiselect'
|
5 |
import { useState, useEffect } from 'react'
|
6 |
import { Slider } from 'primereact/slider'
|
7 |
-
import
|
8 |
|
9 |
const LanguageTable = ({ data, selectedLanguages, setSelectedLanguages }) => {
|
10 |
const [filters, setFilters] = useState({
|
@@ -14,7 +14,7 @@ const LanguageTable = ({ data, selectedLanguages, setSelectedLanguages }) => {
|
|
14 |
})
|
15 |
|
16 |
const families = [...new Set(data.map(item => item.family))].slice(0, 10)
|
17 |
-
families.push(
|
18 |
const familyRowFilterTemplate = options => {
|
19 |
return (
|
20 |
<MultiSelect
|
@@ -43,7 +43,7 @@ const LanguageTable = ({ data, selectedLanguages, setSelectedLanguages }) => {
|
|
43 |
return (population / 1000).toFixed(0) + 'K'
|
44 |
} else if (population < 10 * 1000 * 1000) {
|
45 |
return (population / 1000 / 1000).toFixed(1) + 'M'
|
46 |
-
}else if (population < 1000 * 1000 * 1000) {
|
47 |
return (population / 1000 / 1000).toFixed(0) + 'M'
|
48 |
} else {
|
49 |
return (population / 1000 / 1000 / 1000).toFixed(1) + 'B'
|
@@ -107,24 +107,21 @@ const LanguageTable = ({ data, selectedLanguages, setSelectedLanguages }) => {
|
|
107 |
}
|
108 |
|
109 |
const languageBodyTemplate = rowData => {
|
110 |
-
return
|
111 |
-
<div
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
return rowData => {
|
120 |
-
const score = rowData[field]
|
121 |
-
return ScoreField(score, minScore, maxScore)
|
122 |
-
}
|
123 |
}
|
124 |
|
125 |
return (
|
126 |
<DataTable
|
127 |
-
value={data.filter(
|
|
|
|
|
128 |
header={<>Languages</>}
|
129 |
sortField='speakers'
|
130 |
removableSort
|
@@ -140,7 +137,7 @@ const LanguageTable = ({ data, selectedLanguages, setSelectedLanguages }) => {
|
|
140 |
id='language-table'
|
141 |
style={{ width: '800px', minHeight: '650px' }}
|
142 |
>
|
143 |
-
<Column selectionMode=
|
144 |
<Column
|
145 |
field='language_name'
|
146 |
header='Language'
|
@@ -151,6 +148,7 @@ const LanguageTable = ({ data, selectedLanguages, setSelectedLanguages }) => {
|
|
151 |
<Column
|
152 |
field='speakers'
|
153 |
header={<i className='pi pi-users' title='Speakers' />}
|
|
|
154 |
body={speakerBodyTemplate}
|
155 |
filter
|
156 |
filterElement={speakerFilterTemplate}
|
@@ -161,60 +159,13 @@ const LanguageTable = ({ data, selectedLanguages, setSelectedLanguages }) => {
|
|
161 |
<Column
|
162 |
field='family'
|
163 |
header='Family'
|
|
|
164 |
filter
|
165 |
showFilterMatchModes={false}
|
166 |
filterElement={familyRowFilterTemplate}
|
167 |
style={{ minWidth: '10rem' }}
|
168 |
/>
|
169 |
-
|
170 |
-
field='average'
|
171 |
-
header='Average'
|
172 |
-
sortable
|
173 |
-
body={scoreBodyTemplate('average', { minScore: 0.2, maxScore: 0.5 })}
|
174 |
-
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
175 |
-
/>
|
176 |
-
<Column
|
177 |
-
field='translation_from_bleu'
|
178 |
-
header="Translation (from)"
|
179 |
-
headerTooltip='Translation performance from a language to all other languages (spBLEU score)'
|
180 |
-
sortable
|
181 |
-
body={scoreBodyTemplate('translation_from_bleu', {
|
182 |
-
minScore: 0,
|
183 |
-
maxScore: 0.5
|
184 |
-
})}
|
185 |
-
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
186 |
-
/>
|
187 |
-
<Column
|
188 |
-
field='translation_to_bleu'
|
189 |
-
header="Translation (to)"
|
190 |
-
headerTooltip='Translation performance from all other languages to a language (spBLEU score)'
|
191 |
-
sortable
|
192 |
-
body={scoreBodyTemplate('translation_to_bleu', {
|
193 |
-
minScore: 0,
|
194 |
-
maxScore: 0.5
|
195 |
-
})}
|
196 |
-
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
197 |
-
/>
|
198 |
-
<Column
|
199 |
-
field='classification_accuracy'
|
200 |
-
header='Classification'
|
201 |
-
sortable
|
202 |
-
body={scoreBodyTemplate('classification_accuracy', {
|
203 |
-
minScore: 0,
|
204 |
-
maxScore: 0.5
|
205 |
-
})}
|
206 |
-
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
207 |
-
/>
|
208 |
-
{/* <Column
|
209 |
-
field='language_modeling_chrf'
|
210 |
-
header='Language Modeling'
|
211 |
-
sortable
|
212 |
-
body={scoreBodyTemplate('language_modeling_chrf', {
|
213 |
-
minScore: 0.8,
|
214 |
-
maxScore: 1
|
215 |
-
})}
|
216 |
-
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
217 |
-
/> */}
|
218 |
</DataTable>
|
219 |
)
|
220 |
}
|
|
|
4 |
import { MultiSelect } from 'primereact/multiselect'
|
5 |
import { useState, useEffect } from 'react'
|
6 |
import { Slider } from 'primereact/slider'
|
7 |
+
import ScoreColumns from './ScoreColumns'
|
8 |
|
9 |
const LanguageTable = ({ data, selectedLanguages, setSelectedLanguages }) => {
|
10 |
const [filters, setFilters] = useState({
|
|
|
14 |
})
|
15 |
|
16 |
const families = [...new Set(data.map(item => item.family))].slice(0, 10)
|
17 |
+
families.push('Other')
|
18 |
const familyRowFilterTemplate = options => {
|
19 |
return (
|
20 |
<MultiSelect
|
|
|
43 |
return (population / 1000).toFixed(0) + 'K'
|
44 |
} else if (population < 10 * 1000 * 1000) {
|
45 |
return (population / 1000 / 1000).toFixed(1) + 'M'
|
46 |
+
} else if (population < 1000 * 1000 * 1000) {
|
47 |
return (population / 1000 / 1000).toFixed(0) + 'M'
|
48 |
} else {
|
49 |
return (population / 1000 / 1000 / 1000).toFixed(1) + 'B'
|
|
|
107 |
}
|
108 |
|
109 |
const languageBodyTemplate = rowData => {
|
110 |
+
return (
|
111 |
+
<div>
|
112 |
+
<div style={{ fontWeight: 'bold' }}>{rowData.autonym}</div>
|
113 |
+
<div style={{ fontSize: '0.8rem', color: 'gray' }}>
|
114 |
+
{rowData.language_name}
|
115 |
+
</div>
|
116 |
+
</div>
|
117 |
+
)
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
|
120 |
return (
|
121 |
<DataTable
|
122 |
+
value={data.filter(
|
123 |
+
item => !selectedLanguages.some(l => l.bcp_47 === item.bcp_47)
|
124 |
+
)}
|
125 |
header={<>Languages</>}
|
126 |
sortField='speakers'
|
127 |
removableSort
|
|
|
137 |
id='language-table'
|
138 |
style={{ width: '800px', minHeight: '650px' }}
|
139 |
>
|
140 |
+
<Column selectionMode='multiple' headerStyle={{ width: '3rem' }} />
|
141 |
<Column
|
142 |
field='language_name'
|
143 |
header='Language'
|
|
|
148 |
<Column
|
149 |
field='speakers'
|
150 |
header={<i className='pi pi-users' title='Speakers' />}
|
151 |
+
headerTooltip='Number of speakers of the language (according to CLDR 2018)'
|
152 |
body={speakerBodyTemplate}
|
153 |
filter
|
154 |
filterElement={speakerFilterTemplate}
|
|
|
159 |
<Column
|
160 |
field='family'
|
161 |
header='Family'
|
162 |
+
headerTooltip='Language family'
|
163 |
filter
|
164 |
showFilterMatchModes={false}
|
165 |
filterElement={familyRowFilterTemplate}
|
166 |
style={{ minWidth: '10rem' }}
|
167 |
/>
|
168 |
+
{ScoreColumns}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
</DataTable>
|
170 |
)
|
171 |
}
|
frontend/src/components/ModelTable.js
CHANGED
@@ -6,7 +6,7 @@ import { useState, useEffect } from 'react'
|
|
6 |
import Medal from './Medal'
|
7 |
import { Slider } from 'primereact/slider'
|
8 |
import ScoreField from './ScoreField'
|
9 |
-
|
10 |
const ModelTable = ({ data }) => {
|
11 |
const [filters, setFilters] = useState({
|
12 |
type: { value: null, matchMode: FilterMatchMode.IN },
|
@@ -173,7 +173,7 @@ const ModelTable = ({ data }) => {
|
|
173 |
id='model-table'
|
174 |
style={{ width: '800px', minHeight: '650px' }}
|
175 |
>
|
176 |
-
<Column field='rank' body={rankBodyTemplate} />
|
177 |
<Column
|
178 |
field='provider_name'
|
179 |
header='Provider'
|
@@ -189,6 +189,7 @@ const ModelTable = ({ data }) => {
|
|
189 |
<Column
|
190 |
field='type'
|
191 |
header={<i className='pi pi-unlock' title='Open weights / API only' />}
|
|
|
192 |
filter
|
193 |
filterElement={typeRowFilterTemplate}
|
194 |
showFilterMatchModes={false}
|
@@ -216,55 +217,7 @@ const ModelTable = ({ data }) => {
|
|
216 |
body={costBodyTemplate}
|
217 |
style={{ minWidth: '5rem' }}
|
218 |
/>
|
219 |
-
|
220 |
-
field='average'
|
221 |
-
header='Average'
|
222 |
-
sortable
|
223 |
-
body={scoreBodyTemplate('average', { minScore: 0, maxScore: 0.6 })}
|
224 |
-
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
225 |
-
/>
|
226 |
-
<Column
|
227 |
-
field='translation_from_bleu'
|
228 |
-
header="Translation (from)"
|
229 |
-
headerTooltip='Translation performance from a language to all other languages (spBLEU score)'
|
230 |
-
sortable
|
231 |
-
body={scoreBodyTemplate('translation_from_bleu', {
|
232 |
-
minScore: 0,
|
233 |
-
maxScore: 0.5
|
234 |
-
})}
|
235 |
-
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
236 |
-
/>
|
237 |
-
<Column
|
238 |
-
field='translation_to_bleu'
|
239 |
-
header="Translation (to)"
|
240 |
-
headerTooltip='Translation performance from all other languages to a language (spBLEU score)'
|
241 |
-
sortable
|
242 |
-
body={scoreBodyTemplate('translation_to_bleu', {
|
243 |
-
minScore: 0,
|
244 |
-
maxScore: 0.5
|
245 |
-
})}
|
246 |
-
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
247 |
-
/>
|
248 |
-
<Column
|
249 |
-
field='classification_accuracy'
|
250 |
-
header='Classification'
|
251 |
-
sortable
|
252 |
-
body={scoreBodyTemplate('classification_accuracy', {
|
253 |
-
minScore: 0,
|
254 |
-
maxScore: 0.9
|
255 |
-
})}
|
256 |
-
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
257 |
-
/>
|
258 |
-
{/* <Column
|
259 |
-
field='language_modeling_chrf'
|
260 |
-
header='Language Modeling'
|
261 |
-
sortable
|
262 |
-
body={scoreBodyTemplate('language_modeling_chrf', {
|
263 |
-
minScore: 0.8,
|
264 |
-
maxScore: 1
|
265 |
-
})}
|
266 |
-
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
267 |
-
/> */}
|
268 |
</DataTable>
|
269 |
)
|
270 |
}
|
|
|
6 |
import Medal from './Medal'
|
7 |
import { Slider } from 'primereact/slider'
|
8 |
import ScoreField from './ScoreField'
|
9 |
+
import ScoreColumns from './ScoreColumns'
|
10 |
const ModelTable = ({ data }) => {
|
11 |
const [filters, setFilters] = useState({
|
12 |
type: { value: null, matchMode: FilterMatchMode.IN },
|
|
|
173 |
id='model-table'
|
174 |
style={{ width: '800px', minHeight: '650px' }}
|
175 |
>
|
176 |
+
<Column field='rank' body={rankBodyTemplate} headerTooltip='Rank' />
|
177 |
<Column
|
178 |
field='provider_name'
|
179 |
header='Provider'
|
|
|
189 |
<Column
|
190 |
field='type'
|
191 |
header={<i className='pi pi-unlock' title='Open weights / API only' />}
|
192 |
+
headerTooltip='Open weights / API only'
|
193 |
filter
|
194 |
filterElement={typeRowFilterTemplate}
|
195 |
showFilterMatchModes={false}
|
|
|
217 |
body={costBodyTemplate}
|
218 |
style={{ minWidth: '5rem' }}
|
219 |
/>
|
220 |
+
{ScoreColumns}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
</DataTable>
|
222 |
)
|
223 |
}
|
frontend/src/components/ScoreColumns.js
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Column } from 'primereact/column'
|
2 |
+
import ScoreField from './ScoreField'
|
3 |
+
|
4 |
+
const scoreBodyTemplate = (field, options = {}) => {
|
5 |
+
const { minScore = 0, maxScore = 1 } = options
|
6 |
+
|
7 |
+
return rowData => {
|
8 |
+
const score = rowData[field]
|
9 |
+
return ScoreField(score, minScore, maxScore)
|
10 |
+
}
|
11 |
+
}
|
12 |
+
|
13 |
+
const ScoreColumns = [
|
14 |
+
<Column
|
15 |
+
field='average'
|
16 |
+
header='Average'
|
17 |
+
headerTooltip='Language Proficiency Score (average of all displayed scores)'
|
18 |
+
sortable
|
19 |
+
body={scoreBodyTemplate('average', { minScore: 0.2, maxScore: 0.5 })}
|
20 |
+
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
21 |
+
/>,
|
22 |
+
<Column
|
23 |
+
field='translation_from_bleu'
|
24 |
+
header='Translation (from)'
|
25 |
+
headerTooltip='Translation performance from a language to all other languages (spBLEU score on a sample of the FLORES+ benchmark)'
|
26 |
+
sortable
|
27 |
+
body={scoreBodyTemplate('translation_from_bleu', {
|
28 |
+
minScore: 0,
|
29 |
+
maxScore: 0.5
|
30 |
+
})}
|
31 |
+
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
32 |
+
/>,
|
33 |
+
<Column
|
34 |
+
field='translation_to_bleu'
|
35 |
+
header='Translation (to)'
|
36 |
+
headerTooltip='Translation performance from all other languages to a language (spBLEU score on a sample of the FLORES+ benchmark)'
|
37 |
+
sortable
|
38 |
+
body={scoreBodyTemplate('translation_to_bleu', {
|
39 |
+
minScore: 0,
|
40 |
+
maxScore: 0.5
|
41 |
+
})}
|
42 |
+
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
43 |
+
/>,
|
44 |
+
<Column
|
45 |
+
field='classification_accuracy'
|
46 |
+
header='Classification'
|
47 |
+
headerTooltip='Classification performance (accuracy on a sample of the FLORES+ benchmark)'
|
48 |
+
sortable
|
49 |
+
body={scoreBodyTemplate('classification_accuracy', {
|
50 |
+
minScore: 0,
|
51 |
+
maxScore: 0.5
|
52 |
+
})}
|
53 |
+
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
54 |
+
/>,
|
55 |
+
// <Column
|
56 |
+
// field='language_modeling_chrf'
|
57 |
+
// header='Language Modeling'
|
58 |
+
// sortable
|
59 |
+
// body={scoreBodyTemplate('language_modeling_chrf', {
|
60 |
+
// minScore: 0.8,
|
61 |
+
// maxScore: 1
|
62 |
+
// })}
|
63 |
+
// style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
64 |
+
// />,
|
65 |
+
<Column
|
66 |
+
field='mmlu_accuracy'
|
67 |
+
header='MMLU'
|
68 |
+
headerTooltip='Question Answering performance (accuracy on a sample of multilingual versions of the MMLU benchmark)'
|
69 |
+
sortable
|
70 |
+
body={scoreBodyTemplate('mmlu_accuracy', {
|
71 |
+
minScore: 0,
|
72 |
+
maxScore: 1
|
73 |
+
})}
|
74 |
+
style={{ minWidth: '5rem', maxWidth: '10rem' }}
|
75 |
+
/>
|
76 |
+
]
|
77 |
+
|
78 |
+
export default ScoreColumns
|