Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
58 changes: 58 additions & 0 deletions analysis/nie/validate_annotation_RC.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "e049acc5",
"metadata": {},
"outputs": [],
"source": [
"# Import libraries\n",
"from pathlib import Path\n",
"import json\n",
"import pandas as pd\n",
"import numpy as np\n",
"from scipy.stats import chi2_contingency, ttest_ind"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2d3c54b3",
"metadata": {},
"outputs": [],
"source": [
"current_path = Path().resolve()\n",
"scenarios_path = current_path.parent.parent / \"scenarios_inputs\" / \"nie\" \n",
"annotated_output_path = current_path.parent.parent / \"annotated_outputs\" / \"nie\"\n",
"\n",
"print(f\"current_path: {current_path}\")\n",
"print(f\"scenarios_path: {scenarios_path}\")\n",
"print(f\"annotated_output_path: {annotated_output_path}\")"
]
},
{
"cell_type": "markdown",
"id": "368992c0",
"metadata": {},
"source": [
"### Function Definitions"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c01b8bfa",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
114 changes: 114 additions & 0 deletions annotated_outputs/nie/nie_scenarios_0_choice_1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<html>
<head>
<script type='text/javascript'src='https://unpkg.com/vis-network/standalone/umd/vis-network.min.js'></script>
<style type='text/css'>
#mynetwork {
width: 1320px;
height: 1320px;
border: 1px solid lightgray;
}
</style>
</head>
<body>
<div id='mynetwork'></div>

<script type="text/javascript">

window.onload = function(){
launch_visualization()
}
function launch_visualization() {
this_dset = return_vis_dataset()
nodes = this_dset[1]
edges = this_dset[0]
// create a network
var container = document.getElementById("mynetwork");
var data = {
nodes: nodes,
edges: edges
};
var options = {
physics: {
enabled: true,
barnesHut: {
theta: 0.5,
gravitationalConstant: -5000,
springLength: 500,
springConstant: 0.01,
damping: 5,
avoidOverlap: 1
}
},
manipulation: {
enabled: true,
initiallyActive: false,
addNode: true,
addEdge: true,
editEdge: true,
deleteNode: true,
deleteEdge: true,
},
nodes: {
shape: "circle",
font: { size: 16 },
},
edges: {
length: 2000,
}, };
// initialize your network!
var network = new vis.Network(container, data, options);
}
function return_vis_dataset() {
var nodes = new vis.DataSet([
{id: 1, label: "i", color: {background: '#279aba'}},
{id: 2, label: "bus with 10 passengers", color: {background: '#279aba'}},
{id: 3, label: "bus with 2 passengers", color: {background: '#279aba'}},
{id: 4, label: "redirect the train to the\n side track", color: {background: '#ba2769'}},
{id: 5, label: "value", color: {background: '#8e7db5'}},
{id: 6, label: "The train moves onto the\n side track", color: {background: '#e6c440'}},
{id: 7, label: "The bus with 2 passengers\n is hit by the train", color: {background: '#e6c440'}},
{id: 8, label: "The 2 passengers on the\n side-track bus are killed", color: {background: '#e6c440'}},
{id: 9, label: "The bus with 10 passengers\n is not hit by the\n train", color: {background: '#e6c440'}},
{id: 10, label: "The 10 passengers on the\n other bus survive", color: {background: '#e6c440'}},
{id: 11, label: "I cause the deaths of\n 2 passengers", color: {background: '#e6c440'}}
]);
var edges = new vis.DataSet([
{from: 1, to: 4, label: "C+I+K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 6, label: "C+I+K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 7, label: "C+I+K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 8, label: "C+I-K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 9, label: "C+I+K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 10, label: "C+I+K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 11, label: "C+I+K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 5, label: "-25.0", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 6, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 7, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 8, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 9, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 10, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 11, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 6, to: 1, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 6, to: 2, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 6, to: 3, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 7, to: 1, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 7, to: 2, label: "-8", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 7, to: 3, label: "-100", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 8, to: 1, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 8, to: 2, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 8, to: 3, label: "-100", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 9, to: 1, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 9, to: 2, label: "95", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 9, to: 3, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 10, to: 1, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 10, to: 2, label: "95", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 10, to: 3, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 11, to: 1, label: "-95", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 11, to: 2, label: "-95", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 11, to: 3, label: "-100", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
]);

return ([edges,nodes])
}
</script>
</body>
</html>
12 changes: 12 additions & 0 deletions annotated_outputs/nie/nie_scenarios_0_choice_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{"node": {"kind": "being", "label": "i"}, "links": [{"link": {"kind": "b-link", "value": "C+I+K+"}, "to_node": "redirect the train to the side track"}, {"link": {"kind": "b_link", "value": "C+I+K+"}, "to_node": "The train moves onto the side track"}, {"link": {"kind": "b_link", "value": "C+I+K+"}, "to_node": "The bus with 2 passengers is hit by the train"}, {"link": {"kind": "b_link", "value": "C+I-K+"}, "to_node": "The 2 passengers on the side-track bus are killed"}, {"link": {"kind": "b_link", "value": "C+I+K+"}, "to_node": "The bus with 10 passengers is not hit by the train"}, {"link": {"kind": "b_link", "value": "C+I+K+"}, "to_node": "The 10 passengers on the other bus survive"}, {"link": {"kind": "b_link", "value": "C+I+K+"}, "to_node": "I cause the deaths of 2 passengers"}]}
{"node": {"kind": "being", "label": "bus with 10 passengers"}, "links": []}
{"node": {"kind": "being", "label": "bus with 2 passengers"}, "links": []}
{"node": {"kind": "action_choice", "label": "redirect the train to the side track"}, "links": [{"link": {"kind": "v-link", "value": "-25.0"}, "to_node": "value"}, {"link": {"kind": "e_link", "value": ""}, "to_node": "The train moves onto the side track"}, {"link": {"kind": "e_link", "value": ""}, "to_node": "The bus with 2 passengers is hit by the train"}, {"link": {"kind": "e_link", "value": ""}, "to_node": "The 2 passengers on the side-track bus are killed"}, {"link": {"kind": "e_link", "value": ""}, "to_node": "The bus with 10 passengers is not hit by the train"}, {"link": {"kind": "e_link", "value": ""}, "to_node": "The 10 passengers on the other bus survive"}, {"link": {"kind": "e_link", "value": ""}, "to_node": "I cause the deaths of 2 passengers"}]}
{"node": {"kind": "value", "label": "value"}, "links": []}
{"node": {"kind": "event", "label": "The train moves onto the side track"}, "links": [{"link": {"kind": "utility", "value": "0"}, "to_node": "i"}, {"link": {"kind": "utility", "value": "0"}, "to_node": "bus with 10 passengers"}, {"link": {"kind": "utility", "value": "0"}, "to_node": "bus with 2 passengers"}]}
{"node": {"kind": "event", "label": "The bus with 2 passengers is hit by the train"}, "links": [{"link": {"kind": "utility", "value": "0"}, "to_node": "i"}, {"link": {"kind": "utility", "value": "-8"}, "to_node": "bus with 10 passengers"}, {"link": {"kind": "utility", "value": "-100"}, "to_node": "bus with 2 passengers"}]}
{"node": {"kind": "event", "label": "The 2 passengers on the side-track bus are killed"}, "links": [{"link": {"kind": "utility", "value": "0"}, "to_node": "i"}, {"link": {"kind": "utility", "value": "0"}, "to_node": "bus with 10 passengers"}, {"link": {"kind": "utility", "value": "-100"}, "to_node": "bus with 2 passengers"}]}
{"node": {"kind": "event", "label": "The bus with 10 passengers is not hit by the train"}, "links": [{"link": {"kind": "utility", "value": "0"}, "to_node": "i"}, {"link": {"kind": "utility", "value": "95"}, "to_node": "bus with 10 passengers"}, {"link": {"kind": "utility", "value": "0"}, "to_node": "bus with 2 passengers"}]}
{"node": {"kind": "event", "label": "The 10 passengers on the other bus survive"}, "links": [{"link": {"kind": "utility", "value": "0"}, "to_node": "i"}, {"link": {"kind": "utility", "value": "95"}, "to_node": "bus with 10 passengers"}, {"link": {"kind": "utility", "value": "0"}, "to_node": "bus with 2 passengers"}]}
{"node": {"kind": "event", "label": "I cause the deaths of 2 passengers"}, "links": [{"link": {"kind": "utility", "value": "-95"}, "to_node": "i"}, {"link": {"kind": "utility", "value": "-95"}, "to_node": "bus with 10 passengers"}, {"link": {"kind": "utility", "value": "-100"}, "to_node": "bus with 2 passengers"}]}
{"version": "90d155baf85f37ea0b9f9e7b984573b9f19948f1"}
108 changes: 108 additions & 0 deletions annotated_outputs/nie/nie_scenarios_0_choice_2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<html>
<head>
<script type='text/javascript'src='https://unpkg.com/vis-network/standalone/umd/vis-network.min.js'></script>
<style type='text/css'>
#mynetwork {
width: 1200px;
height: 1200px;
border: 1px solid lightgray;
}
</style>
</head>
<body>
<div id='mynetwork'></div>

<script type="text/javascript">

window.onload = function(){
launch_visualization()
}
function launch_visualization() {
this_dset = return_vis_dataset()
nodes = this_dset[1]
edges = this_dset[0]
// create a network
var container = document.getElementById("mynetwork");
var data = {
nodes: nodes,
edges: edges
};
var options = {
physics: {
enabled: true,
barnesHut: {
theta: 0.5,
gravitationalConstant: -5000,
springLength: 500,
springConstant: 0.01,
damping: 5,
avoidOverlap: 1
}
},
manipulation: {
enabled: true,
initiallyActive: false,
addNode: true,
addEdge: true,
editEdge: true,
deleteNode: true,
deleteEdge: true,
},
nodes: {
shape: "circle",
font: { size: 16 },
},
edges: {
length: 2000,
}, };
// initialize your network!
var network = new vis.Network(container, data, options);
}
function return_vis_dataset() {
var nodes = new vis.DataSet([
{id: 1, label: "i", color: {background: '#279aba'}},
{id: 2, label: "10 bus passengers on the\n current track", color: {background: '#279aba'}},
{id: 3, label: "2 bus passengers on the\n side track", color: {background: '#279aba'}},
{id: 4, label: "keep the train on the\n same track", color: {background: '#ba2769'}},
{id: 5, label: "value", color: {background: '#8e7db5'}},
{id: 6, label: "The train hits the bus\n with 10 passengers", color: {background: '#e6c440'}},
{id: 7, label: "The 10 passengers on the\n bus are killed", color: {background: '#e6c440'}},
{id: 8, label: "The bus with 2 passengers\n on the side track is\n not hit", color: {background: '#e6c440'}},
{id: 9, label: "The 2 passengers on the\n side-track bus remain alive", color: {background: '#e6c440'}},
{id: 10, label: "I do not redirect the\n train", color: {background: '#e6c440'}}
]);
var edges = new vis.DataSet([
{from: 1, to: 4, label: "C+I+K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 6, label: "C+I-K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 7, label: "C-I-K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 8, label: "C+I-K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 9, label: "C+I-K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 1, to: 10, label: "C+I+K+", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 5, label: "37.0", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 6, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 7, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 8, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 9, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 4, to: 10, label: "", color: {color: '#b518a8', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 6, to: 1, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 6, to: 2, label: "-100", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 6, to: 3, label: "-95", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 7, to: 1, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 7, to: 2, label: "-100", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 7, to: 3, label: "-95", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 8, to: 1, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 8, to: 2, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 8, to: 3, label: "95", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 9, to: 1, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 9, to: 2, label: "0", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 9, to: 3, label: "100", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 10, to: 1, label: "-95", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 10, to: 2, label: "-100", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
{from: 10, to: 3, label: "-95", color: {color: '#62a3a2', highlight: '#f540e6'}, font: { size: 18 }, arrows: { to: { enabled: true, type: 'arrow'}}},
]);

return ([edges,nodes])
}
</script>
</body>
</html>
Loading