-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
paper,finding_number,finding_type,parity,std,finding type,synthesizer,epsilon | ||
iverson22football,0,,0.0,0.0,DESCRIPTIVE_STATISTICS,privbayes,0.37 | ||
iverson22football,1,,1.0,0.0,DESCRIPTIVE_STATISTICS,privbayes,0.37 | ||
iverson22football,2,,1.0,0.0,DESCRIPTIVE_STATISTICS,privbayes,0.37 | ||
iverson22football,3,,1.0,0.0,TEMPORAL_FIXED_CLASS,privbayes,0.37 | ||
iverson22football,4,,1.0,0.0,TEMPORAL_FIXED_CLASS,privbayes,0.37 | ||
iverson22football,5,,0.0,0.0,TEMPORAL_FIXED_CLASS,privbayes,0.37 | ||
iverson22football,6,,0.6799999999999998,0.4664761515876243,TEMPORAL_FIXED_CLASS,privbayes,0.37 | ||
lee2021ability,0,,1.0,0.0,PEARSON_CORRELATION,privbayes,0.37 | ||
lee2021ability,1,,1.0,0.0,PEARSON_CORRELATION,privbayes,0.37 | ||
lee2021ability,2,,1.0,0.0,PEARSON_CORRELATION,privbayes,0.37 | ||
lee2021ability,3,,1.0,0.0,COEFFICIENT_SIGN,privbayes,0.37 | ||
lee2021ability,4,,1.0,0.0,COEFFICIENT_SIGN,privbayes,0.37 | ||
iverson22football,0,,1.0,0.0,DESCRIPTIVE_STATISTICS,privbayes,1.0 | ||
iverson22football,1,,1.0,0.0,DESCRIPTIVE_STATISTICS,privbayes,1.0 | ||
iverson22football,2,,1.0,0.0,DESCRIPTIVE_STATISTICS,privbayes,1.0 | ||
iverson22football,3,,0.6399999999999999,0.4800000000000001,TEMPORAL_FIXED_CLASS,privbayes,1.0 | ||
iverson22football,4,,0.5999999999999999,0.4898979485566359,TEMPORAL_FIXED_CLASS,privbayes,1.0 | ||
iverson22football,5,,0.5999999999999999,0.4898979485566359,TEMPORAL_FIXED_CLASS,privbayes,1.0 | ||
iverson22football,6,,0.6399999999999999,0.4800000000000001,TEMPORAL_FIXED_CLASS,privbayes,1.0 | ||
lee2021ability,0,,1.0,0.0,PEARSON_CORRELATION,privbayes,1.0 | ||
lee2021ability,1,,1.0,0.0,PEARSON_CORRELATION,privbayes,1.0 | ||
lee2021ability,2,,1.0,0.0,PEARSON_CORRELATION,privbayes,1.0 | ||
lee2021ability,3,,1.0,0.0,COEFFICIENT_SIGN,privbayes,1.0 | ||
lee2021ability,4,,1.0,0.0,COEFFICIENT_SIGN,privbayes,1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"data": [[0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.6799999999999998, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 0.6399999999999999, 0.5999999999999999, 0.5999999999999999, 0.6399999999999999, 1.0, 1.0, 1.0, 1.0, 1.0]], "columns": ["iverson22football-0", "iverson22football-1", "iverson22football-2", "iverson22football-3", "iverson22football-4", "iverson22football-5", "iverson22football-6", "lee2021ability-0", "lee2021ability-1", "lee2021ability-2", "lee2021ability-3", "lee2021ability-4"], "index": ["privbayes - 0.37", "privbayes - 1.0"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Interactive Heatmap</title> | ||
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script> | ||
</head> | ||
<body> | ||
<div id="heatmap"></div> | ||
|
||
<script> | ||
// Fetch the data | ||
fetch('formatted_data.json') | ||
.then(response => response.json()) | ||
.then(data => { | ||
// Prepare data for Plotly | ||
const trace = { | ||
z: data.data, | ||
x: Array.from({ length: data.columns.length }, (_, i) => i + 1), | ||
y: data.index, | ||
type: 'heatmap', | ||
hoverinfo: 'z+x+y', | ||
colorscale: [[0, 'black'], [1, 'white']], | ||
showscale: true, | ||
xgap: 1, | ||
ygap: 1, | ||
}; | ||
|
||
// Generate the paper_to_finding_count map dynamically | ||
const paper_to_finding_count = {}; | ||
for (const col of data.columns) { | ||
const [paper, _] = col.split('-'); | ||
paper_to_finding_count[paper] = (paper_to_finding_count[paper] || 0) + 1; | ||
} | ||
|
||
// Prepare annotations for the paper names | ||
let annotations = []; | ||
let counter = 0; | ||
|
||
for (const paper of Object.keys(paper_to_finding_count)) { | ||
const occurrences = paper_to_finding_count[paper]; | ||
|
||
annotations.push({ | ||
x: counter + occurrences / 2 - 0.5, | ||
y: 0, | ||
xref: 'x', | ||
yref: 'paper', | ||
text: paper, | ||
showarrow: false, | ||
font: { | ||
size: 12, | ||
}, | ||
yshift: -40 // Shift the annotation down | ||
}); | ||
|
||
counter += occurrences; | ||
} | ||
|
||
// Layout configuration | ||
const layout = { | ||
title: 'Epistemic Parity', | ||
xaxis: { | ||
tickvals: Array.from({ length: data.columns.length }, (_, i) => i), | ||
ticktext: Array.from({ length: data.columns.length }, (_, i) => i + 1), | ||
}, | ||
annotations: annotations, | ||
}; | ||
|
||
const config = { | ||
responsive: true, | ||
}; | ||
|
||
// Generate the plot | ||
Plotly.newPlot('heatmap', [trace], layout, config); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import pandas as pd\n", | ||
"import json\n", | ||
"\n", | ||
"df = pd.read_csv('data.csv')\n", | ||
"\n", | ||
"# grouping data based on 'synthesizer' and 'epsilon'\n", | ||
"grouped = df.groupby(['synthesizer', 'epsilon'])\n", | ||
"\n", | ||
"data = []\n", | ||
"columns = []\n", | ||
"index = []\n", | ||
"\n", | ||
"for (synthesizer, epsilon), group in grouped:\n", | ||
" # sort based on 'paper' and 'finding_number'\n", | ||
" group = group.sort_values(['paper', 'finding_number'])\n", | ||
" \n", | ||
" if not columns:\n", | ||
" columns = list(group['paper'] + '-' + group['finding_number'].astype(str))\n", | ||
" \n", | ||
" index.append(f\"{synthesizer} - {epsilon}\")\n", | ||
" data.append(group['parity'].tolist())\n", | ||
"\n", | ||
"result = {\n", | ||
" 'data': data,\n", | ||
" 'columns': columns,\n", | ||
" 'index': index\n", | ||
"}\n", | ||
"\n", | ||
"with open('formatted_data.json', 'w') as f:\n", | ||
" json.dump(result, f)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.12" | ||
}, | ||
"orig_nbformat": 4, | ||
"vscode": { | ||
"interpreter": { | ||
"hash": "6597d1ed23b894caf154b6750f098a8514a19e03807460ffd2d8425103778dc0" | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |