Migrate notebook A2 to Python3
"cell_type": "markdown",
"metadata": {},
"source": [
- "# MadMiner particle physics tutorial\n",
- "\n",
"# Appendix 2: Ensemble methods\n",
"\n",
"Johann Brehmer, Felix Kling, Irina Espejo, and Kyle Cranmer 2018-2019"
]
},
{
- "cell_type": "markdown",
+ "cell_type": "code",
"metadata": {},
"source": [
- "## (UNDER CONSTRUCTION)"
- ]
+ "from madminer import Ensemble\n",
+ "from madminer import FisherInformation\n",
+ "from madminer import ScoreEstimator\n",
+ "from madminer import plot_fisher_information_contours_2d"
+ ],
+ "execution_count": null,
+ "outputs": []
},
{
"cell_type": "markdown",
"outputs": [],
"source": [
"ensemble.train_all(\n",
- " method='sally',\n",
- " x='data/samples/x_train.npy',\n",
- " t_xz='data/samples/t_xz_train.npy',\n",
+ " method=\"sally\",\n",
+ " x=\"data/samples/x_train.npy\",\n",
+ " t_xz=\"data/samples/t_xz_train.npy\",\n",
" n_epochs=5,\n",
")\n",
"\n",
- "ensemble.save('models/sally_ensemble')"
+ "ensemble.save(\"models/sally_ensemble\")"
]
},
{
"metadata": {},
"outputs": [],
"source": [
- "fisher = FisherInformation('data/madminer_example_shuffled.h5')\n",
+ "fisher = FisherInformation(\"data/madminer_example_shuffled.h5\")\n",
"\n",
- "fisher_information_mean, fisher_information_covariance = fisher.calculate_fisher_information_full_detector(\n",
- " theta=[0.,0.],\n",
- " model_file='models/sally_ensemble',\n",
- " luminosity=3000000.,\n",
- " mode='information'\n",
+ "(\n",
+ " fisher_information_mean,\n",
+ " fisher_information_covariance,\n",
+ ") = fisher.calculate_fisher_information_full_detector(\n",
+ " theta=[0.0, 0.0],\n",
+ " model_file=\"models/sally_ensemble\",\n",
+ " luminosity=3000000.0,\n",
+ " mode=\"information\",\n",
")"
]
},
" [fisher_information_mean],\n",
" [fisher_information_covariance],\n",
" xrange=(-1, 1),\n",
- " yrange=(-1,1)\n",
+ " yrange=(-1, 1),\n",
")"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {
"kernelspec": {
- "display_name": "Python 2",
+ "display_name": "Python 3",
"language": "python",
- "name": "python2"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
- "version": 2
+ "version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
- "pygments_lexer": "ipython2",
- "version": "2.7.15"
+ "pygments_lexer": "ipython3",
+ "version": "3.8.2"
}
},
"nbformat": 4,
