Skip to content

Commit

Permalink
fixed merge
Browse files Browse the repository at this point in the history
  • Loading branch information
reneehlozek committed Sep 11, 2019
2 parents b36347c + e3a58a4 commit 86c5141
Show file tree
Hide file tree
Showing 28 changed files with 1,600 additions and 1,199 deletions.
220 changes: 220 additions & 0 deletions Plot_Table3.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import pickle\n",
"\n",
"import matplotlib as mpl\n",
"# print(mpl.rcParams.items)\n",
"mpl.use('Agg')\n",
"mpl.rcParams['text.usetex'] = False\n",
"mpl.rcParams['mathtext.rm'] = 'serif'\n",
"mpl.rcParams['font.family'] = 'serif'\n",
"mpl.rcParams['font.serif'] = ['Times New Roman']\n",
"# mpl.rcParams['font.family'] = ['Times New Roman']\n",
"mpl.rcParams['axes.titlesize'] = 25\n",
"mpl.rcParams['axes.labelsize'] = 20\n",
"mpl.rcParams['xtick.labelsize'] = 15\n",
"mpl.rcParams['ytick.labelsize'] = 15\n",
"mpl.rcParams['savefig.dpi'] = 250\n",
"mpl.rcParams['figure.dpi'] = 250\n",
"mpl.rcParams['savefig.format'] = 'pdf'\n",
"mpl.rcParams['savefig.bbox'] = 'tight'\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def truncate_colormap(cmap, minval=0.0, maxval=1.0, n=100):\n",
" new_cmap = mpl.colors.LinearSegmentedColormap.from_list(\n",
" 'trunc({n},{a:.2f},{b:.2f})'.format(n=cmap.name, a=minval, b=maxval),\n",
" cmap(np.linspace(minval, maxval, n)))\n",
" return new_cmap\n",
"\n",
"cmap = plt.get_cmap('hot_r')\n",
"fave_cmap = truncate_colormap(cmap, 0.35, 1.0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"metric_dictionary = {'TBDT':{'FoM': 1, 'LogLoss': 1, 'Brier': 1},\n",
" 'TKNN':{'FoM': 7, 'LogLoss': 6, 'Brier': 7},\n",
" 'TNB':{'FoM': 8, 'LogLoss': 9, 'Brier': 8},\n",
" 'TNN':{'FoM': 5, 'LogLoss': 3, 'Brier': 3},\n",
" 'TSVM':{'FoM': 3, 'LogLoss': 2, 'Brier': 2},\n",
" 'WBDT':{'FoM': 2, 'LogLoss': 5, 'Brier': 4},\n",
" 'WKNN':{'FoM': 9, 'LogLoss': 8, 'Brier': 9},\n",
" 'WNB':{'FoM': 10, 'LogLoss': 10, 'Brier': 10},\n",
" 'WNN':{'FoM': 6, 'LogLoss': 7, 'Brier': 6},\n",
" 'WSVM':{'FoM': 4, 'LogLoss': 4, 'Brier': 5},\n",
" }"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"metric_dictionary['TBDT']"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"symbols = {'TBDT':'o',\n",
" 'TKNN':'d',\n",
" 'TNB':'s',\n",
" 'TNN':'*',\n",
" 'TSVM':'^',\n",
" 'WBDT':'o',\n",
" 'WKNN':'d',\n",
" 'WNB':'s',\n",
" 'WNN':'*',\n",
" 'WSVM':'^',\n",
" }\n",
"\n",
"colors = {'TBDT':fave_cmap(0.05),\n",
" 'TKNN':fave_cmap(0.3),\n",
" 'TNB':fave_cmap(0.55),\n",
" 'TNN':fave_cmap(0.8),\n",
" 'TSVM':fave_cmap(1.0),\n",
" 'WBDT':fave_cmap(0.05),\n",
" 'WKNN':fave_cmap(0.3),\n",
" 'WNB':fave_cmap(0.55),\n",
" 'WNN':fave_cmap(0.75),\n",
" 'WSVM':fave_cmap(1.0),\n",
" }\n",
"\n",
"\n",
"plt.figure()\n",
"for key, value in metric_dictionary.items():\n",
" val = []\n",
" for k, v in value.items():\n",
" val.append(v)\n",
" if 'W' in key:\n",
" plt.plot(val, label=key, marker=symbols[key], ls='--', color=colors[key])\n",
" else:\n",
" plt.plot(val, label=key, marker=symbols[key], color=colors[key])\n",
"\n",
"plt.legend(loc='center left', bbox_to_anchor=(1, 0.5), prop={'size': 12})\n",
"plt.xticks([0, 1, 2], ['FoM', 'LogLoss', 'Brier'])\n",
"plt.yticks(np.arange(1, 11))\n",
"plt.ylabel('Rank')\n",
"\n",
"#plt.savefig('Tables3_option1.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"colors = {'TBDT':fave_cmap(0.05),\n",
" 'TKNN':fave_cmap(0.2375),\n",
" 'TNB':fave_cmap(0.54),\n",
" 'TNN':fave_cmap(0.712499999),\n",
" 'TSVM':fave_cmap(1.0),\n",
" 'WBDT':fave_cmap(0.05),\n",
" 'WKNN':fave_cmap(0.2375),\n",
" 'WNB':fave_cmap(0.54),\n",
" 'WNN':fave_cmap(0.712499999),\n",
" 'WSVM':fave_cmap(1.0),\n",
" }\n",
"\n",
"plt.figure()\n",
"for key, value in metric_dictionary.items():\n",
" val = []\n",
" for k, v in value.items():\n",
" val.append(v)\n",
" if 'W' in key:\n",
" plt.plot(val, label=key, marker=symbols[key], ls='--', color=colors[key], lw=2, ms=7, alpha=0.3)\n",
" else:\n",
" plt.plot(val, label=key, marker=symbols[key], color=colors[key], lw=2, ms=7)\n",
"\n",
"plt.legend(loc='center left', bbox_to_anchor=(1, 0.5), prop={'size': 12})\n",
"plt.xticks([0, 1, 2], ['FoM', 'LogLoss', 'Brier'])\n",
"plt.yticks(np.arange(1, 11))\n",
"plt.ylabel('Rank')\n",
"plt.gca().invert_yaxis()\n",
"\n",
"#plt.savefig('Tables3_option4.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure()\n",
"\n",
"fom = []\n",
"ll = []\n",
"brier = []\n",
"\n",
"for key, value in metric_dictionary.items():\n",
" fom.append(value['FoM'])\n",
" ll.append(value['LogLoss'])\n",
" brier.append(value['Brier'])\n",
"\n",
"plt.plot(fom, label='FoM', marker='o')\n",
"plt.plot(ll, label='LogLoss', marker='D', alpha = 0.5)\n",
"plt.plot(brier, label='Brier', marker='s', alpha=0.23)\n",
"\n",
"plt.legend(loc='center left', bbox_to_anchor=(1, 0.5), prop={'size': 12})\n",
"plt.xticks(np.arange(0, 10), list(metric_dictionary.keys()), rotation=45)\n",
"plt.ylabel('Rank')\n",
"plt.savefig('Tables3_option2.pdf')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.15"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
5 changes: 3 additions & 2 deletions paper/authors.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Lastname,Firstname,Authorname,AuthorType,Affiliation,Contribution,Email
Malz,Alex,A.I.~Malz,Contact,"German Centre of Cosmological Lensing, Ruhr-Universitaet Bochum, Universitaetsstra{\ss}e 150, 44801 Bochum, Germany","conceptualization, data curation, formal analysis, investigation, methodology, project administration, software, supervision, validation, visualization, writing - editing, writing - original draft",[email protected]
Malz,Alex,A.I.~Malz,Contact,"Center for Cosmology and Particle Physics, New York University, 726 Broadway, New York, NY 10004, USA","conceptualization, data curation, formal analysis, investigation, methodology, project administration, software, supervision, validation, visualization, writing - editing, writing - original draft",[email protected]
Malz,Alex,A.I.~Malz,Contact,"Department of Physics, New York University, 726 Broadway, New York, NY 10004, USA","conceptualization, data curation, formal analysis, investigation, methodology, project administration, software, supervision, validation, visualization, writing - editing, writing - original draft",[email protected]
Hlo\v{z}ek,Ren\'ee,R.~Hlo\v{z}ek,Contributor,"Department of Astronomy and Astrophysics, University of Toronto, 50 St. George St., Toronto, ON M5S 3H4, Canada","data curation, formal analysis, funding acquisition, investigation, project administration, software, supervision, validation, visualization, writing - editing, writing - original draft",[email protected]
Hlo\v{z}ek,Ren\'ee,R.~Hlo\v{z}ek,Contributor,"Dunlap Institute for Astronomy and Astrophysics, University of Toronto, 50 St. George St., Toronto, ON M5S 3H4, Canada","data curation, formal analysis, funding acquisition, investigation, project administration, software, supervision, validation, visualization, writing - editing, writing - original draft",[email protected]
Allam,Tarek,T.~Allam Jr,Contributor,"Mullard Space Science Laboratory, Department of Space and Climate Physics, University College London, Holmbury Hill Rd, Dorking RH5 6NT, UK","investigation, software, validation, writing - original draft",[email]
Bahmanyar,Anita,A.~Bahmanyar,Contributor,"Dunlap Institute for Astronomy and Astrophysics, University of Toronto, 50 St. George St., Toronto, ON M5S 3H4, Canada","formal analysis, investigation, methodology, software, writing - editing, writing - original draft",[email]
Biswas,Rahul,R.~Biswas,Contributor,"The Oskar Klein Centre for Cosmoparticle Physics, Stockholm University, AlbaNova, Stockholm, SE-106 91, Sweden","conceptualization, methodology, software, writing - original draft",[email]
Biswas,Rahul,R.~Biswas,Contributor,"The Oskar Klein Centre for Cosmoparticle Physics, Stockholm University, AlbaNova, Stockholm, SE-106 91, Sweden","conceptualization, methodology, software, supervision, writing - editing, writing - original draft",[email]
Dai,Mi,M.~Dai,Contributor,"Rutgers, the State University of New Jersey, 136 Frelinghuysen Road, Piscataway, NJ 08854 USA","writing - editing",[email]
Galbany,Llu\'is,L.~Galbany,Contributor,"University of Pittsburgh, 300 Allen Hall, 3941 O'Hara St, Pittsburgh, PA 15260","writing - editing",[email]
Ishida,Emille,E.E.O.~Ishida,Contributor,"Universit\'e Clermont Auvergne, CNRS/IN2P3, LPC, F-63000 Clermont-Ferrand, France","conceptualization, project administration, supervision, writing - editing",[email]
Expand All @@ -25,5 +26,5 @@ Narayan,Gautham,G.~Narayan,Contributor,"Space Telescope Science Institute, 3700
Peiris,Hiranya,H.~Peiris,Contributor,"The Oskar Klein Centre for Cosmoparticle Physics, Stockholm University, AlbaNova, Stockholm, SE-106 91, Sweden","conceptualization, funding acquisition, supervision",[email]
Peiris,Hiranya,H.~Peiris,Contributor,"Department of Physics and Astronomy, University College London, Gower Street, London, WC1E 6BT, UK","conceptualization, funding acquisition, supervision",[email]
Peters,Christina~M.,C.M.~Peters,Contributor,"Dunlap Institute for Astronomy and Astrophysics, University of Toronto, 50 St. George St., Toronto, ON M5S 3H4, Canada","writing - editing",[email]
Ponder,Kara,K.~Ponder,Contributor,"Berkeley Center for Cosmological Physics, Campbell Hall 341, University of California Berkeley, Berkeley, CA 94720, USA","writing - editing",[email]
Ponder,Kara,K.~Ponder,Contributor,"Berkeley Center for Cosmological Physics, Campbell Hall 341, University of California Berkeley, Berkeley, CA 94720, USA","visualization, writing - editing",[email]
Setzer,Christian,C.N.~Setzer,Contributor,"The Oskar Klein Centre for Cosmoparticle Physics, Stockholm University, AlbaNova, Stockholm, SE-106 91, Sweden","conceptualization, software",[email protected]
Binary file added paper/fig/Tables3_option4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified paper/fig/all_sim_cm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified paper/fig/all_snphotcc_cm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified paper/fig/combined.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified paper/fig/examples.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 20 additions & 13 deletions paper/hacks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@
"weight_vecs = np.array([[i] + [(1. - i) / (M_classes - 1.)] * (M_classes - 1) for i in possible_weights])\n",
"which_weight_schemes = {str(i): weight_vecs[i] for i in range(len(possible_weights))}\n",
"\n",
"alt_mega_test = load_collector('fig/test'+str(M_classes)+'_fromcmdm.pkl')"
"# alt_mega_test = load_collector('fig/test'+str(M_classes)+'_fromcmdm.pkl')"
]
},
{
Expand Down Expand Up @@ -1452,17 +1452,17 @@
"source": [
"# connect lines along systematic, weighting, and affected class\n",
"def wt_only_plot(dataset, metric_info, shapes, style='rel'):\n",
" baselines = dataset.keys()\n",
" baselines = list(dataset.keys())\n",
" fig = pylab.figure(figsize=(10.2, 10.))\n",
" bigAxes = pylab.axes(frameon=False) # hide frame\n",
" bigAxes.set_xticks([]) # don't want to see any ticks on this axis\n",
" bigAxes.set_yticks([])\n",
" bigAxesP = bigAxes.twinx()\n",
" bigAxesP.set_yticks([])\n",
" bigAxes.set_ylabel(metric_info.keys()[0], fontsize=20, labelpad=25, color=metric_info.values()[0])\n",
" bigAxes.set_ylabel(list(metric_info.keys())[0], fontsize=20, labelpad=25, color=list(metric_info.values())[0])\n",
" bigAxes.set_xlabel(style+r'. weight on class', fontsize=20, labelpad=25)\n",
" bigAxesP.set_ylabel(metric_info.keys()[1], rotation=270, fontsize=20, \n",
" labelpad=50, color=metric_info.values()[1])\n",
" bigAxesP.set_ylabel(list(metric_info.keys())[1], rotation=270, fontsize=20, \n",
" labelpad=50, color=list(metric_info.values())[1])\n",
" bigAxes.set_title('tunnel on baselines')\n",
" for si in range(len(baselines)):\n",
" s = baselines[si]\n",
Expand Down Expand Up @@ -1493,12 +1493,12 @@
" ax.text(.5, .9, s, \n",
" horizontalalignment='center',\n",
" transform=ax.transAxes, fontsize=20)\n",
" ax.plot(wts[style].T[0], dataset[s][metric_info.keys()[0]],\n",
" ax.plot(wts[style].T[0], dataset[s][list(metric_info.keys())[0]],\n",
" marker=shapes[s],\n",
" alpha=0.5, c=metric_info.values()[0])\n",
" axp.plot(wts[style].T[0], dataset[s][metric_info.keys()[1]],\n",
" alpha=0.5, c=list(metric_info.values())[0])\n",
" axp.plot(wts[style].T[0], dataset[s][list(metric_info.keys())[1]],\n",
" marker=shapes[s],\n",
" alpha=0.5, c=metric_info.values()[1])\n",
" alpha=0.5, c=list(metric_info.values())[1])\n",
" ax.set_ylim(-0.05, 2.75)\n",
" axp.set_ylim(-0.001, 0.081)\n",
"# ax.set_xlim(-0.25, 2.25)\n",
Expand Down Expand Up @@ -2071,15 +2071,22 @@
"# jupyter nbconvert desc_note/main.ipynb --TagRemovePreprocessor.remove_cell_tags='[\"hideme\"]'\n",
"# jupyter nbconvert desc_note/main.ipynb --TagRemovePreprocessor.remove_input_tags='[\"hidein\"]'\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"anaconda-cloud": {},
"celltoolbar": "Tags",
"kernelspec": {
"display_name": "ProClaM (Python 3)",
"language": "python",
"name": "proclam_3"
"display_name": "Python 3",
"language": "python3",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -2091,7 +2098,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.6.8"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 86c5141

Please sign in to comment.