Skip to content

Commit

Permalink
feat(webpage): Add IR test page (#293)
Browse files Browse the repository at this point in the history
* feat(webpage): Add IR test page

* Fix errors and add QA to leaderboard
  • Loading branch information
ktagowski authored Sep 20, 2023
1 parent a65e90d commit 9ce347e
Show file tree
Hide file tree
Showing 11 changed files with 255 additions and 115 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,6 @@ _proc
_docs

lepiszcze-submissions/
checkpoints/
checkpoints/
# Local Netlify folder
.netlify
1 change: 1 addition & 0 deletions webpage/.netlify/edge-functions-import-map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"imports":{"@netlify/edge-functions":"https://edge.netlify.com/v1/index.ts","netlify:edge":"https://edge.netlify.com/v1/index.ts?v=legacy"},"scopes":{}}
11 changes: 11 additions & 0 deletions webpage/content/tasks/taskIR.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
url: "/tasks/InformationRetrieval"
type: docs
geekdocNav: false
geekdocBreadcrumb: false
---

{{< pageHeader >}}
{{< info taskname="Information Retrieval" taskdesc="Information Retrieval (IR) is the process of locating and retrieving relevant data or documents from a large dataset based on user queries, often used in search engines">}}
{{< averageResults tasktype="Information Retrieval" >}}
{{< results type="Information Retrieval" >}}
11 changes: 11 additions & 0 deletions webpage/content/tasks/taskQA.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
url: "/tasks/QuestionAnswering"
type: docs
geekdocNav: false
geekdocBreadcrumb: false
---

{{< pageHeader >}}
{{< info taskname="Question Answering" taskdesc="Extractive Question Answering identifies precise spans within a document to answer a query, without generating new text or rephrasing">}}
{{< averageResults tasktype="Question Answering">}}
{{< results type="Question Answering" >}}
25 changes: 25 additions & 0 deletions webpage/data/results/msmarco_bm_25.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"submission_name": "msmarco_bm_25",
"dataset_name": "MSMARCO",
"dataset_version": "0.0.0",
"embedding_name": "BM25",
"hparams": {},
"packages": [],
"config": null,
"leaderboard_task_name": "Information Retrieval",
"metrics": [
{
"NDCG@10": 31.50,
"MRR@10": 56.36
}
],
"metrics_avg": {
"NDCG@10": 31.50,
"MRR@10": 56.36
},
"metrics_std": {
"NDCG@10": 0.0,
"MRR@10": 0.0
},
"averaged_over": 1
}
25 changes: 25 additions & 0 deletions webpage/data/results/msmarco_ict.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"submission_name": "msmarco_ict",
"dataset_name": "MSMARCO",
"dataset_version": "0.0.0",
"embedding_name": "ICT",
"hparams": {},
"packages": [],
"config": null,
"leaderboard_task_name": "Information Retrieval",
"metrics": [
{
"NDCG@10": 29.02,
"MRR@10": 43.91
}
],
"metrics_avg": {
"NDCG@10": 29.02,
"MRR@10": 43.91
},
"metrics_std": {
"NDCG@10": 0.0,
"MRR@10": 0.0
},
"averaged_over": 1
}
34 changes: 34 additions & 0 deletions webpage/data/results/qa_all_allegro__herbert-base-cased.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"submission_name": "qa_all_allegro__herbert-base-cased",
"dataset_name": "qa_all",
"dataset_version": "0.0.0",
"embedding_name": "allegro/herbert-base-cased",
"hparams": {},
"packages": [],
"config": null,
"leaderboard_task_name": "Question Answering",
"metrics": [
{
"f1": 81.06677705918307,
"exact": 72.24858757062147,
"HasAns_f1": 72.2968454891892,
"HasAns_exact": 56.738437001594896,
"NoAns_f1": 92.54042775169536
}
],
"metrics_avg": {
"f1": 81.06677705918307,
"exact": 72.24858757062147,
"HasAns_f1": 72.2968454891892,
"HasAns_exact": 56.738437001594896,
"NoAns_f1": 92.54042775169536
},
"metrics_std": {
"f1": 0,
"exact": 0,
"HasAns_f1": 0,
"HasAns_exact": 0,
"NoAns_f1": 0
},
"averaged_over": 1
}
214 changes: 112 additions & 102 deletions webpage/layouts/shortcodes/averageResults.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@

{{ $metrics := slice }}
{{ $metricsToIgnore := slice "classes" "f1_weighted" "recall_weighted" "precision_weighted" }}
{{ range $.Site.Data.results }}
{{ range $k, $v := .metrics_avg }}
{{if (not (in $metricsToIgnore $k)) }}
{{ $metrics = uniq ($metrics | append $k) }}
{{end}}
{{ end }}
{{ range $file, $result := $.Site.Data.results }}
{{if or (eq $tasktype "Tasks") (eq (index $result "leaderboard_task_name") $tasktype)}}
{{if (not (or (eq (index $result "leaderboard_task_name") "Information Retrieval") (eq (index $result "leaderboard_task_name") "Question Answering")))}}
{{ range $k, $v := .metrics_avg }}
{{if (not (in $metricsToIgnore $k)) }}
{{ $metrics = uniq ($metrics | append $k) }}
{{end}}
{{ end }}
{{end}}
{{end}}
{{ end }}
{{ $sum := slice }}
<style scoped>
Expand All @@ -27,121 +31,127 @@

</style>
<div style="margin: 0 2em;">
<div class="container title-container">
{{ if eq $tasktype "Tasks"}}
<div class="container title-container">
{{ if eq $tasktype "Tasks"}}
<div class="title">Model ranking</div>
<p style="text-align: center;">Average model performance across all tasks.</p>
{{else}}
<div class="title">Model's task ranking</div>
<p style="text-align: center;">Average model performance across task datasets.</p>
{{else}}
{{if (not (or (eq $tasktype "Information Retrieval") (eq $tasktype "Question Answering")))}}
<div class="title">Model's task ranking</div>
<p style="text-align: center;">Average model performance across task datasets.</p>
{{end}}

{{end}}

</div>
{{if (not (or (eq $tasktype "Information Retrieval") (eq $tasktype "Question Answering")))}}

<div id="data-tasktype" style="visibility: hidden; height: 0px; overflow: hidden;">{{ $tasktype }}</div>
<div id="data-average" style="visibility: hidden; height: 0px; overflow: hidden;">
{{ range $model := $models }}
{{ range $metric := $metrics }}
{{ range $file, $result := $.Site.Data.results }}
{{if eq (index $result "embedding_name") $model}}
{{ $sum := ($sum | append (index $result "metrics_avg" $metric))}}
<div> {{ $model }};;{{ $metric }};;{{(index $result "leaderboard_task_name")}};;{{(index $result "dataset_name")}};;{{index $result "metrics_avg" $metric}}</div>
<div id="data-tasktype" style="visibility: hidden; height: 0px; overflow: hidden;">{{ $tasktype }}</div>
<div id="data-average" style="visibility: hidden; height: 0px; overflow: hidden;">
{{ range $model := $models }}
{{ range $metric := $metrics }}
{{ range $file, $result := $.Site.Data.results }}
{{if eq (index $result "embedding_name") $model}}
{{ $sum := ($sum | append (index $result "metrics_avg" $metric))}}
<div> {{ $model }};;{{ $metric }};;{{(index $result "leaderboard_task_name")}};;{{(index $result "dataset_name")}};;{{index $result "metrics_avg" $metric}}</div>
{{end}}
{{end}}
{{end}}
{{end}}
{{end}}
</div>
<div style="display: flex; justify-content: center;"><div class="lds-ring" id="average-spinner"><div></div><div></div><div></div><div></div></div></div>
<table id="data-table" style="display: none;">
<thead>
<tr>
<th>
Model
</th>
{{ range $metric := $metrics }}
</div>
<div style="display: flex; justify-content: center;"><div class="lds-ring" id="average-spinner"><div></div><div></div><div></div><div></div></div></div>
<table id="data-table" style="display: none;">
<thead>
<tr>
<th>
{{ $metric | humanize }}
Model
</th>
{{end}}
</tr>
</thead>
<tr id="table-rows">
{{ range $metric := $metrics }}
<th>
{{ $metric | humanize }}
</th>
{{end}}
</tr>
</thead>
<tr id="table-rows">

</tr>
</table>
</tr>
</table>
{{end}}

<script>
let table = new Tabulator("#data-table", {
layout:"fitColumns",
movableColumns: true
});

let formattedColumns = table.getColumnDefinitions().map(c => {
c.formatter = "html";
return c
})
formattedColumns.forEach((col,i) => {
if(i==0){
col.headerFilter = true;
col.widthGrow = 3;
col.minWidth= 180;
}else{
col.formatter = "money";
col.hozAlign = "center";
col.formatterParams = {
precision:3,
};
col.headerFilter = false;
}
})
table.setColumns(formattedColumns);
if (document.querySelector('#data-table')) {
let table = new Tabulator("#data-table", {
layout:"fitColumns",
movableColumns: true
});

let formattedColumns = table.getColumnDefinitions().map(c => {
c.formatter = "html";
return c
})
formattedColumns.forEach((col,i) => {
if(i==0){
col.headerFilter = true;
col.widthGrow = 3;
col.minWidth= 180;
}else{
col.formatter = "money";
col.hozAlign = "center";
col.formatterParams = {
precision:3,
};
col.headerFilter = false;
}
})
table.setColumns(formattedColumns);


table.setSort("f1_macro", "desc")
const dataDiv = document.getElementById("data-average");
let array = [...dataDiv.children];
let dataArray = []
array.forEach((el)=>{
const temp = el.innerHTML.split(";;");
dataArray.push({model: temp[0], metric: temp[1], task: temp[2], dataset: temp[3], value: temp[4]})
})

table.setSort("f1_macro", "desc")
const dataDiv = document.getElementById("data-average");
let array = [...dataDiv.children];
let dataArray = []
array.forEach((el)=>{
const temp = el.innerHTML.split(";;");
dataArray.push({model: temp[0], metric: temp[1], task: temp[2], dataset: temp[3], value: temp[4]})
})
const tasktype = document.getElementById("data-tasktype").innerHTML;
const uniqueModels = [...new Set(dataArray.map(item => item.model))];
const uniqueMetric = [...new Set(dataArray.map(item => item.metric))];

const tasktype = document.getElementById("data-tasktype").innerHTML;
const uniqueModels = [...new Set(dataArray.map(item => item.model))];
const uniqueMetric = [...new Set(dataArray.map(item => item.metric))];

let values = new Array(0);
uniqueModels.forEach(model => {
let modelObj = {model: model};
dataArray.forEach(el =>{
if( (tasktype == "Tasks" || el.task == tasktype) && el.model == model){
uniqueMetric.forEach( m =>{
if(el.metric == m){
if(modelObj[m+"_sum"] == undefined){
modelObj[m+"_sum"] = +el.value;
modelObj[m+"_count"] = 1;
modelObj[m] = modelObj[m+"_sum"] / modelObj[m+"_count"];
}else{
modelObj[m+"_sum"] += +el.value;
modelObj[m+"_count"] += 1;
modelObj[m] = modelObj[m+"_sum"] / modelObj[m+"_count"];
let values = new Array(0);
uniqueModels.forEach(model => {
let modelObj = {model: model};
dataArray.forEach(el =>{
if( (tasktype == "Tasks" || el.task == tasktype) && el.model == model){
uniqueMetric.forEach( m =>{
if(el.metric == m){
if(modelObj[m+"_sum"] == undefined){
modelObj[m+"_sum"] = +el.value;
modelObj[m+"_count"] = 1;
modelObj[m] = modelObj[m+"_sum"] / modelObj[m+"_count"];
}else{
modelObj[m+"_sum"] += +el.value;
modelObj[m+"_count"] += 1;
modelObj[m] = modelObj[m+"_sum"] / modelObj[m+"_count"];
}
}
}
})
}
})
if(Object.keys(modelObj).length>1){
const deleteKeys = Object.keys(modelObj).filter( item => item.includes("_sum") || item.includes("_count"));
deleteKeys.forEach(d => {
delete modelObj[d];
})
values.push(modelObj);
}
})
if(Object.keys(modelObj).length>1){
const deleteKeys = Object.keys(modelObj).filter( item => item.includes("_sum") || item.includes("_count"));
deleteKeys.forEach(d => {
delete modelObj[d];
})
values.push(modelObj);
}
})
table.replaceData(values);
const content = document.getElementById("data-table");
const spinner = document.getElementById("average-spinner");
content.style.display = "block";
spinner.style.display = "none";

table.replaceData(values);
const content = document.getElementById("data-table");
const spinner = document.getElementById("average-spinner");
content.style.display = "block";
spinner.style.display = "none";
}
</script>
4 changes: 3 additions & 1 deletion webpage/layouts/shortcodes/homepage.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ <h1 class="title">LEPISZCZE</h1>
"Entailment Classification",
"Aspect-based Sentiment Analysis",
"Abusive Clauses Detection",
"Dialogue Acts Classification"
"Dialogue Acts Classification",
"Information Retrieval",
"Question Answering"
];
const container = document.getElementById("tasks-container");
taskTypes.forEach((type) => {
Expand Down
Loading

0 comments on commit 9ce347e

Please sign in to comment.