Commit b91ed467 authored by Shengpu Tang (tangsp)'s avatar Shengpu Tang (tangsp)
Browse files

code and output for evaluation

parent 7163abc0
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import svgutils.transform as sg\n",
"import sys"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# ROC/PR/Calibration"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"prefix = 'Calibration'"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"#create new SVG figure\n",
"fig = sg.SVGFigure(\"576px\", \"576px\")"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"# load matpotlib-generated figures\n",
"fig11 = sg.fromfile('figures/{}.ARF.T=4.dt=1.0.svg'.format(prefix))\n",
"fig12 = sg.fromfile('figures/{}.Shock.T=4.dt=1.0.svg'.format(prefix))\n",
"fig21 = sg.fromfile('figures/{}.ARF.T=12.dt=1.0.svg'.format(prefix))\n",
"fig22 = sg.fromfile('figures/{}.Shock.T=12.dt=1.0.svg'.format(prefix))\n",
"\n",
"# get the plot objects\n",
"plot11 = fig11.getroot()\n",
"plot12 = fig12.getroot()\n",
"plot21 = fig21.getroot()\n",
"plot22 = fig22.getroot()\n",
"\n",
"plot11.moveto(0, 0, scale=4/3)\n",
"plot12.moveto(287, 0, scale=4/3)\n",
"plot21.moveto(0, 287, scale=4/3)\n",
"plot22.moveto(287, 287, scale=4/3)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"# add text labels\n",
"txt1 = sg.TextElement(10,20, \"A\", size=14, weight=\"bold\")\n",
"txt2 = sg.TextElement(287,20, \"B\", size=14, weight=\"bold\")\n",
"txt3 = sg.TextElement(10,20+287, \"C\", size=14, weight=\"bold\")\n",
"txt4 = sg.TextElement(287,20+287, \"D\", size=14, weight=\"bold\")"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"# append plots and labels to figure\n",
"fig.append([plot11, plot12, plot21, plot22])\n",
"fig.append([txt1, txt2, txt3, txt4])"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"# save generated SVG files\n",
"fig.save(\"figures/{}_final.svg\".format(prefix))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Prediction Gap"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"#create new SVG figure\n",
"fig = sg.SVGFigure(\"960px\", \"576px\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"# load matpotlib-generated figures\n",
"fig11 = sg.fromfile('figures/PredGap-ARF_4.svg')\n",
"fig12 = sg.fromfile('figures/PredGap-Shock_4.svg')\n",
"fig21 = sg.fromfile('figures/PredGap-ARF_12.svg')\n",
"fig22 = sg.fromfile('figures/PredGap-Shock_12.svg')\n",
"\n",
"# get the plot objects\n",
"plot11 = fig11.getroot()\n",
"plot12 = fig12.getroot()\n",
"plot21 = fig21.getroot()\n",
"plot22 = fig22.getroot()\n",
"\n",
"plot11.moveto(0, 0, scale=4/3)\n",
"plot12.moveto(480, 0, scale=4/3)\n",
"plot21.moveto(0, 287, scale=4/3)\n",
"plot22.moveto(480, 287, scale=4/3)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"# add text labels\n",
"txt1 = sg.TextElement(10,20, \"A\", size=14, weight=\"bold\")\n",
"txt2 = sg.TextElement(480,20, \"B\", size=14, weight=\"bold\")\n",
"txt3 = sg.TextElement(10,20+287, \"C\", size=14, weight=\"bold\")\n",
"txt4 = sg.TextElement(480,20+287, \"D\", size=14, weight=\"bold\")"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"# append plots and labels to figure\n",
"fig.append([plot11, plot12, plot21, plot22])\n",
"fig.append([txt1, txt2, txt3, txt4])"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"# save generated SVG files\n",
"fig.save(\"figures/PredGap_final.svg\")"
]
},
{
"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.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment