|
16 | 16 | "```python\n",
|
17 | 17 | "from zfit.minimize import Minuit\n",
|
18 | 18 | "\n",
|
19 |
| - "nll = zfit.unbinned_nll(pdf, data, norm_range=(-10, 10))\n", |
| 19 | + "nll = zfit.unbinned_nll(pdf, data, norm=(-10, 10))\n", |
20 | 20 | "minimizer = Minuit()\n",
|
21 | 21 | "minimizer.minimize(nll, params)\n",
|
22 | 22 | "minimizer.hesse(params)\n",
|
|
85 | 85 | "\n",
|
86 | 86 | "The main methods of the PDF are then\n",
|
87 | 87 | "\n",
|
88 |
| - "- Getting the probability through the `probs` method, which **MUST** be called with a data array `x` and a normalization range `norm_range` as inputs. For example:\n", |
| 88 | + "- Getting the probability through the `probs` method, which **MUST** be called with a data array `x` and a normalization range `norm` as inputs. For example:\n", |
89 | 89 | "\n",
|
90 | 90 | " ```\n",
|
91 | 91 | " # Get the probabilities of some random generated events\n",
|
92 |
| - " probs = gauss.prob(x=np.random.random(10), norm_range=(-30., 30))\n", |
| 92 | + " probs = gauss.prob(x=np.random.random(10), norm=(-30., 30))\n", |
93 | 93 | " ```\n",
|
94 |
| - "- there **MUST** be the option to *temporarely* set the norm_range of a pdf with a contextmanager.**(ALBERT: mention it? ok?)**\n", |
| 94 | + "- there **MUST** be the option to *temporarely* set the norm of a pdf with a contextmanager.**(ALBERT: mention it? ok?)**\n", |
95 | 95 | "\n",
|
96 | 96 | " ```python\n",
|
97 |
| - " with pdf.temp_norm_range((1, 5)):\n", |
98 |
| - " pdf.prob(data) # norm_range is now set\n", |
| 97 | + " with pdf.temp_norm((1, 5)):\n", |
| 98 | + " pdf.prob(data) # norm is now set\n", |
99 | 99 | " ```\n",
|
100 | 100 | "\n",
|
101 |
| - "- Getting the value of its integral in some given `limits`. While the `norm_range` is also mandatory here, it may be requested that this integral is calculated over the unnormalized PDF by setting it to `False`:\n", |
| 101 | + "- Getting the value of its integral in some given `limits`. While the `norm` is also mandatory here, it may be requested that this integral is calculated over the unnormalized PDF by setting it to `False`:\n", |
102 | 102 | "\n",
|
103 | 103 | " ```python\n",
|
104 | 104 | " # Calculate the integral between -5 and 3 over the PDF normalized between -30 and 30\n",
|
105 |
| - " integral_norm = gauss.integrate(limits=(-5, 3), norm_range=(-30., 30))\n", |
| 105 | + " integral_norm = gauss.integrate(limits=(-5, 3), norm=(-30., 30))\n", |
106 | 106 | " # Calculate the unnormalized integral\n",
|
107 |
| - " integral_unnorm = gauss.integrate(limits=(-5, 3), norm_range=False)\n", |
| 107 | + " integral_unnorm = gauss.integrate(limits=(-5, 3), norm=False)\n", |
108 | 108 | " ```\n",
|
109 | 109 | "\n",
|
110 | 110 | "- Sampling from the PDF is done through the `sample` method, which **MUST** include the number of events `n_draws` as well as the limits from which to draw (`limits`):\n",
|
|
114 | 114 | " sample = gauss.sample(n_draws=1000, limits=(-10, 10))\n",
|
115 | 115 | " ```\n",
|
116 | 116 | "\n",
|
117 |
| - "Additionally, extended PDFs, which will result in anything using a `norm_range` to not return the probability but the number probability (the function will be normalized to this yield instead of 1 inside the `norm_range`), can be created through the `set_yield` method, which **MUST** get a parameter as input:\n", |
| 117 | + "Additionally, extended PDFs, which will result in anything using a `norm` to not return the probability but the number probability (the function will be normalized to this yield instead of 1 inside the `norm`), can be created through the `set_yield` method, which **MUST** get a parameter as input:\n", |
118 | 118 | "\n",
|
119 | 119 | "```python\n",
|
120 | 120 | "yield1 = Parameter(\"yield1\", 100, 0, 1000)\n",
|
121 | 121 | "gauss.set_yield(yield1)\n",
|
122 | 122 | "# This integral yields approx 100\n",
|
123 |
| - "integral_extended = gauss.integrate(limits=(-10, 10), norm_range=(-10, 10))\n", |
| 123 | + "integral_extended = gauss.integrate(limits=(-10, 10), norm=(-10, 10))\n", |
124 | 124 | "```\n",
|
125 | 125 | "\n",
|
126 | 126 | "The `is_extended` property can be then used to check whether a PDF is extended or not.\n",
|
|
131 | 131 | "```python\n",
|
132 | 132 | "my_loss = zfit.unbinned_nll(gauss,\n",
|
133 | 133 | " data,\n",
|
134 |
| - " norm_range=(-10, 10),\n", |
| 134 | + " norm=(-10, 10),\n", |
135 | 135 | " constraints={})\n",
|
136 | 136 | "```"
|
137 | 137 | ]
|
|
254 | 254 | "# we use the core one to highlight the use of tensorflow graphs\n",
|
255 | 255 | "\n",
|
256 | 256 | "\n",
|
257 |
| - "def api_unbinned_nll(pdf, data, norm_range):\n", |
258 |
| - " return zfit.core.loss.unbinned_nll(pdf.prob(data, norm_range=norm_range))\n", |
| 257 | + "def api_unbinned_nll(pdf, data, norm):\n", |
| 258 | + " return zfit.core.loss.unbinned_nll(pdf.prob(data, norm=norm))\n", |
259 | 259 | "\n",
|
260 | 260 | "\n",
|
261 | 261 | "mu1 = zfit.Parameter(\"mu\", 5.0, 0., 10)\n",
|
|
0 commit comments