Skip to content

Commit

Permalink
docs: add note about fixing parameters (#112)
Browse files Browse the repository at this point in the history
* build: bump version to 0.0.0a0
* docs: remove no PyPI package warning
* docs: add note about fixing parameters
  • Loading branch information
redeboer authored Jul 9, 2020
1 parent 125c29c commit e59803a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 44 deletions.
5 changes: 0 additions & 5 deletions doc/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ procedure.
Installation through PyPI
-------------------------

.. attention::

`tensorwaves` is currently under development, so there currently exists no
PyPI package!

`tensorwaves` is `available as a PyPI package
<https://pypi.org/project/tensorwaves/>`_, so installation is super easy:

Expand Down
2 changes: 1 addition & 1 deletion examples/workflow/1_create_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"metadata": {},
"outputs": [],
"source": [
"stm.allowed_intermediate_particles = ['f0']"
"stm.allowed_intermediate_particles = [\"f0\"]"
]
},
{
Expand Down
73 changes: 36 additions & 37 deletions examples/workflow/3_perform_fit.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@
]
},
{
"cell_type": "markdown",
"metadata": {},
"cell_type": "raw",
"metadata": {
"raw_mimetype": "text/restructuredtext"
},
"source": [
"To perform a fit, you need to define an **estimator**. An estimator is a measure for the discrepancy between the intensity model and the data distribution to which you fit. In PWA, we usually use an *unbinned negative log likelihood estimator*, which can be created as follows with the `tensorwaves.estimator` module:"
]
Expand All @@ -93,13 +95,6 @@
"estimator = UnbinnedNLL(intensity, data_set)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3.2 Modify parameters"
]
},
{
"cell_type": "raw",
"metadata": {
Expand All @@ -115,27 +110,7 @@
"metadata": {},
"outputs": [],
"source": [
"initial_parameters = estimator.parameters\n",
"initial_parameters"
]
},
{
"cell_type": "raw",
"metadata": {
"raw_mimetype": "text/restructuredtext"
},
"source": [
"You can modify these initial parameters beforehand in the YAML recipe file or modify the parameters here, through Python. To make the fit a bit more interesting, we change a few of the initial values of the parameters:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"initial_parameters[\"Width_f0(980)\"] = 0.2\n",
"initial_parameters[\"Mass_f0(1500)\"] = 1.6"
"estimator.parameters"
]
},
{
Expand All @@ -162,7 +137,7 @@
"source": [
"import tensorflow as tf\n",
"\n",
"tf.get_logger().setLevel('ERROR')"
"tf.get_logger().setLevel(\"ERROR\")"
]
},
{
Expand All @@ -171,11 +146,24 @@
"raw_mimetype": "text/restructuredtext"
},
"source": [
"Starting the fit itself is quite simple: just create an optimizer instance of your choice, here `Minuit2 <https://root.cern.ch/doc/master/Minuit2Page.html>`_, and call its :meth:`~.Minuit2.optimize` method to start the fitting process.\n",
"\n",
".. note::\n",
"Starting the fit itself is quite simple: just create an optimizer instance of your choice, here `Minuit2 <https://root.cern.ch/doc/master/Minuit2Page.html>`_, and call its :meth:`~.Minuit2.optimize` method to start the fitting process. Notice that the :meth:`~.Minuit2.optimize` method requires a second argument. This is a mapping of parameter names that you want to fit to their initial values. **Parameters not listed in that `dict`, are not optimized.**\n",
"\n",
" The computation time depends on the complexity of the model, number of data events, the size of the phase space sample, and the number of free parameters, but it **could take a a few minutes**."
"So let's select a few of the parameters that we saw in :ref:`usage/3_perform_fit:3.1 Define estimator` and feed them to the optimizer to run the fit. Notice that we modify the parameters slightly to make the fit more interesting (we are running using a data sample that was generated with this very amplitude model after all)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"initial_parameters = {\n",
" \"Phase_J/psi_to_f0(1500)_0+gamma_-1;f0(1500)_to_pi0_0+pi0_0;\": 0.0,\n",
" \"Mass_f0(980)\": 1.1,\n",
" \"Width_f0(980)\": 0.1,\n",
" \"Mass_f0(1500)\": 1.4,\n",
" \"Width_f0(1500)\": 0.2,\n",
"}"
]
},
{
Expand All @@ -191,6 +179,17 @@
"result"
]
},
{
"cell_type": "raw",
"metadata": {
"raw_mimetype": "text/restructuredtext"
},
"source": [
".. note::\n",
"\n",
" The computation time depends on the complexity of the model, number of data events, the size of the phase space sample, and the number of free parameters. This model is rather small and has but a few free parameters, so the optimization shouldn't take more than a few minutes."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -211,9 +210,9 @@
"raw_mimetype": "text/restructuredtext"
},
"source": [
".. todo::\n",
".. warning::\n",
"\n",
" See `issue 99 <https://github.com/ComPWA/tensorwaves/issues/99>`_."
" This functionality has not yet been implemented. See `issue 99 <https://github.com/ComPWA/tensorwaves/issues/99>`_."
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = tensorwaves
version = 0.0.0-alpha
version = 0.0.0-alpha0
author = The ComPWA Team
author_email = [email protected]
maintainer_email = [email protected]
Expand Down

0 comments on commit e59803a

Please sign in to comment.