diff --git a/_unused/API.ipynb b/_unused/API.ipynb index 9c95549..7199278 100755 --- a/_unused/API.ipynb +++ b/_unused/API.ipynb @@ -98,26 +98,26 @@ "\n", "The main methods of the PDF are:\n", "\n", - "- Getting the probability through the `prob` method, which **MUST** be called with a data array `x` and a normalization range `norm_range` as inputs. For example:\n", + "- Getting the probability through the `prob` method, which **MUST** be called with a data array `x` and a normalization range `norm` as inputs. For example:\n", "\n", " ```python\n", " # Get the probabilities of some random generated events\n", - " probs = gauss.prob(x=np.random.random(10), norm_range=(-30., 30))\n", + " probs = gauss.prob(x=np.random.random(10), norm=(-30., 30))\n", " ```\n", "\n", - "- Getting the value of its integral in some given `limits` with the `integrate` method. While the `norm_range` **MUST** be given here, it **MAY** also be requested that this integral is calculated over the unnormalized PDF by setting it to `False`:\n", + "- Getting the value of its integral in some given `limits` with the `integrate` method. While the `norm` **MUST** be given here, it **MAY** also be requested that this integral is calculated over the unnormalized PDF by setting it to `False`:\n", "\n", " ```python\n", " # Calculate the integral between -5 and 3 over the PDF normalized between -30 and 30\n", - " integral_norm = gauss.integrate(limits=(-5, 3), norm_range=(-30., 30))\n", + " integral_norm = gauss.integrate(limits=(-5, 3), norm=(-30., 30))\n", " # Calculate the unnormalized integral\n", - " integral_unnorm = gauss.integrate(limits=(-5, 3), norm_range=False)\n", + " integral_unnorm = gauss.integrate(limits=(-5, 3), norm=False)\n", " ```\n", "\n", - "- Getting the gradient through the **gradient** method, which **MUST** get the data arra `x` and the normalization range `norm_range` as inputs (which, as always, can be set to `False` and therefore no normalization is done). Additionally, the list of parameters with respect to which the integral is performed **MAY** be given through the `params` argument:\n", + "- Getting the gradient through the **gradient** method, which **MUST** get the data arra `x` and the normalization range `norm` as inputs (which, as always, can be set to `False` and therefore no normalization is done). Additionally, the list of parameters with respect to which the integral is performed **MAY** be given through the `params` argument:\n", "\n", " ```python\n", - " gradient = gauss.gradient(x=np.random.random(10), norm_range=(-30, 30), params=['mu'])\n", + " gradient = gauss.gradient(x=np.random.random(10), norm=(-30, 30), params=['mu'])\n", " ```\n", "\n", "- 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", @@ -127,22 +127,22 @@ " sample = gauss.sample(n_draws=1000, limits=(-10, 10))\n", " ```\n", "\n", - "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", + "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", "\n", "```python\n", "yield1 = Parameter(\"yield1\", 100, 0, 1000)\n", "gauss.set_yield(yield1)\n", "# This integral yields approx 100\n", - "integral_extended = gauss.integrate(limits=(-10, 10), norm_range=(-10, 10))\n", + "integral_extended = gauss.integrate(limits=(-10, 10), norm=(-10, 10))\n", "```\n", "\n", "The `is_extended` property can be then used to check whether a PDF is extended or not.\n", "\n", - "Finally, there **MUST** be the option to *temporarily* set the norm_range of a pdf with a context manager in order to perform several operations and make code more readable.\n", + "Finally, there **MUST** be the option to *temporarily* set the norm of a pdf with a context manager in order to perform several operations and make code more readable.\n", "\n", "```python\n", - "with pdf.temp_norm_range((-30, 30)):\n", - " pdf.prob(data) # norm_range is now set\n", + "with pdf.temp_norm((-30, 30)):\n", + " pdf.prob(data) # norm is now set\n", " pdf.integrate(limits=(-5, 3))\n", "```\n" ] @@ -153,7 +153,7 @@ "source": [ "## Loss functions\n", "\n", - "Loss functions can then be build using `pdf.prob`, following a common interface, in which the model, the dataset and the fit range (which internally sets `norm_range` in the PDF and makes sure data only within that range are used) **MUST** be given, and where parameter constraints in form of a dictionary `{param: constraint}` **MAY** be given.\n", + "Loss functions can then be build using `pdf.prob`, following a common interface, in which the model, the dataset and the fit range (which internally sets `norm` in the PDF and makes sure data only within that range are used) **MUST** be given, and where parameter constraints in form of a dictionary `{param: constraint}` **MAY** be given.\n", "\n", "As an example for unbinned NLL, one would write\n", "\n", diff --git a/_unused/Summary.ipynb b/_unused/Summary.ipynb index f9184b5..7ba0abd 100644 --- a/_unused/Summary.ipynb +++ b/_unused/Summary.ipynb @@ -16,7 +16,7 @@ "```python\n", "from zfit.minimize import Minuit\n", "\n", - "nll = zfit.unbinned_nll(pdf, data, norm_range=(-10, 10))\n", + "nll = zfit.unbinned_nll(pdf, data, norm=(-10, 10))\n", "minimizer = Minuit()\n", "minimizer.minimize(nll, params)\n", "minimizer.hesse(params)\n", @@ -85,26 +85,26 @@ "\n", "The main methods of the PDF are then\n", "\n", - "- 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", + "- 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", "\n", " ```\n", " # Get the probabilities of some random generated events\n", - " probs = gauss.prob(x=np.random.random(10), norm_range=(-30., 30))\n", + " probs = gauss.prob(x=np.random.random(10), norm=(-30., 30))\n", " ```\n", - "- there **MUST** be the option to *temporarely* set the norm_range of a pdf with a contextmanager.**(ALBERT: mention it? ok?)**\n", + "- there **MUST** be the option to *temporarely* set the norm of a pdf with a contextmanager.**(ALBERT: mention it? ok?)**\n", "\n", " ```python\n", - " with pdf.temp_norm_range((1, 5)):\n", - " pdf.prob(data) # norm_range is now set\n", + " with pdf.temp_norm((1, 5)):\n", + " pdf.prob(data) # norm is now set\n", " ```\n", "\n", - "- 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", + "- 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", "\n", " ```python\n", " # Calculate the integral between -5 and 3 over the PDF normalized between -30 and 30\n", - " integral_norm = gauss.integrate(limits=(-5, 3), norm_range=(-30., 30))\n", + " integral_norm = gauss.integrate(limits=(-5, 3), norm=(-30., 30))\n", " # Calculate the unnormalized integral\n", - " integral_unnorm = gauss.integrate(limits=(-5, 3), norm_range=False)\n", + " integral_unnorm = gauss.integrate(limits=(-5, 3), norm=False)\n", " ```\n", "\n", "- 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,13 +114,13 @@ " sample = gauss.sample(n_draws=1000, limits=(-10, 10))\n", " ```\n", "\n", - "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", + "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", "\n", "```python\n", "yield1 = Parameter(\"yield1\", 100, 0, 1000)\n", "gauss.set_yield(yield1)\n", "# This integral yields approx 100\n", - "integral_extended = gauss.integrate(limits=(-10, 10), norm_range=(-10, 10))\n", + "integral_extended = gauss.integrate(limits=(-10, 10), norm=(-10, 10))\n", "```\n", "\n", "The `is_extended` property can be then used to check whether a PDF is extended or not.\n", @@ -131,7 +131,7 @@ "```python\n", "my_loss = zfit.unbinned_nll(gauss,\n", " data,\n", - " norm_range=(-10, 10),\n", + " norm=(-10, 10),\n", " constraints={})\n", "```" ] @@ -254,8 +254,8 @@ "# we use the core one to highlight the use of tensorflow graphs\n", "\n", "\n", - "def api_unbinned_nll(pdf, data, norm_range):\n", - " return zfit.core.loss.unbinned_nll(pdf.prob(data, norm_range=norm_range))\n", + "def api_unbinned_nll(pdf, data, norm):\n", + " return zfit.core.loss.unbinned_nll(pdf.prob(data, norm=norm))\n", "\n", "\n", "mu1 = zfit.Parameter(\"mu\", 5.0, 0., 10)\n", diff --git a/_unused/kstmumu_tutorial.py b/_unused/kstmumu_tutorial.py index 76af712..081da41 100755 --- a/_unused/kstmumu_tutorial.py +++ b/_unused/kstmumu_tutorial.py @@ -151,7 +151,7 @@ def invariant_mass(four_momenta): lambda_rare.set_value(-0.003) # here we temporarily set the normalization range to the right side only -with comb_bkg_rare.set_norm_range(obs_bkg): +with comb_bkg_rare.set_norm(obs_bkg): right_tale_loss = zfit.loss.UnbinnedNLL(comb_bkg_rare, right_tale_data_rare) minimizer = zfit.minimize.Minuit(verbosity=7) result_right_tale = minimizer.minimize(right_tale_loss) @@ -187,7 +187,7 @@ def invariant_mass(four_momenta): # create the model to fit # set the normalization range of the exponential to the whole range -comb_bkg_rare.set_norm_range(obs) +comb_bkg_rare.set_norm(obs) # parameters for the model mu = zfit.Parameter("mu", 5270, 5200, 5350) diff --git a/_website/tutorials/components/50 - Custom code and run mode.ipynb b/_website/tutorials/components/50 - Custom code and run mode.ipynb index 60fe262..fdad4c8 100644 --- a/_website/tutorials/components/50 - Custom code and run mode.ipynb +++ b/_website/tutorials/components/50 - Custom code and run mode.ipynb @@ -273,7 +273,7 @@ "This can be useful for debugging, as now every Tensor has a value and every operation is executed immediately.\n", "\n", "Another problem is that building a graph becomes only efficient if we execute it multiple times, not just a single time. But for plotting a pdf for example, just a single call to `pdf` is needed.\n", - "Furthermore, since different objects (e.g. different datasets, `norm_range` etc.) will create a new graph, things can become very slow, caching many graphs that often are not needed anymore.\n", + "Furthermore, since different objects (e.g. different datasets, `norm` etc.) will create a new graph, things can become very slow, caching many graphs that often are not needed anymore.\n", "\n", "The `z.function` decorator is in fact more powerful then the pure `tf.function`: it allow to tell what kind of function is wrapped and this on the other hand allows zfit to be \"smart\" about which function to trace and which not. By default, any method of models (`pdf`, `integrate`,...) are executed eagerly, without graphs. On the other hand, if a loss is built, this builds a graph of everything. Mainly, this behavior is wanted.\n", "\n", @@ -357,7 +357,7 @@ "source": [ "## Graph caching and slowness\n", "\n", - "Repeated calls to graph building functions are sometimes necessary, e.g. when scanning over a range and changing the `norm_range`, which renders the validity of the graph invalid. We can have a look at an example." + "Repeated calls to graph building functions are sometimes necessary, e.g. when scanning over a range and changing the `norm`, which renders the validity of the graph invalid. We can have a look at an example." ] }, { diff --git a/_website/tutorials/components/62 - Multidim Custom PDF.ipynb b/_website/tutorials/components/62 - Multidim Custom PDF.ipynb index b06f4bf..f81926b 100644 --- a/_website/tutorials/components/62 - Multidim Custom PDF.ipynb +++ b/_website/tutorials/components/62 - Multidim Custom PDF.ipynb @@ -119,7 +119,7 @@ "We could improve our PDF by registering an integral. This requires a few steps:\n", " - define our integral as a function in python\n", " - define in which space our integral is valid, e.g. whether it is an integral over all axis or only partial and whether any limit is valid or only special (e.g. from -inf to inf)\n", - " - register the integral and say if it supports additional things (e.g. norm_range)\n", + " - register the integral and say if it supports additional things (e.g. norm)\n", "\n", "Let's start defining the function. This takes, for an integral over all axes, three parameters:\n", " - limits: the actual limits the integral is over\n", diff --git a/_website/tutorials/guides/custom_models.ipynb b/_website/tutorials/guides/custom_models.ipynb index 4067316..55a3f60 100644 --- a/_website/tutorials/guides/custom_models.ipynb +++ b/_website/tutorials/guides/custom_models.ipynb @@ -166,8 +166,8 @@ " return limit + 0.5 * b * limit ** 2 + 1 / 3 * c * limit ** 3\n", "\n", "\n", - "def integral_func(limits, norm_range, params, model):\n", - " del norm_range, model # not needed\n", + "def integral_func(limits, norm, params, model):\n", + " del norm, model # not needed\n", "\n", " b = params['b']\n", " c = params['c']\n", @@ -466,7 +466,7 @@ "\n", "**To remember**: in order to have full control over a public function such as `integrate`, `pdf`, `sample` or `normalization`, the private method, e.g. `_integrate` can be overriden and is _guaranteed_ to be called before other possibilities.\n", "\n", - "In the case above, `pdf` called first `_pdf` (which is not implemented), so it calls `_unnormalized_pdf` and divides this by the `normalization`. The latter also does not have an explicit implementation (`_implementation`), so it uses the fallback and calls `integrate` over the `norm_range`. Since `_integrate` is not provided, the fallback tries to perform an analytic integral, which is not available. Therefore, it integrates the `_unnormalized_prob` numerically. In all of this calls, we can hook in by overriding the mentioned, specified methods.\n", + "In the case above, `pdf` called first `_pdf` (which is not implemented), so it calls `_unnormalized_pdf` and divides this by the `normalization`. The latter also does not have an explicit implementation (`_implementation`), so it uses the fallback and calls `integrate` over the `norm`. Since `_integrate` is not provided, the fallback tries to perform an analytic integral, which is not available. Therefore, it integrates the `_unnormalized_prob` numerically. In all of this calls, we can hook in by overriding the mentioned, specified methods.\n", "\n", "What we did not mention: `ZPDF` is just a wrapper around the actual `BasePDF` that should be preferred in general; it simply provides a convenient `__init__`. For the next example, we will implement a multidimensional PDF and use the custom `__init__`" ] @@ -481,7 +481,7 @@ "source": [ "### Overriding `pdf`\n", "\n", - "Before, we used `_unnormalized_pdf`, which is the common use-case. Even if we want to add an analytic integral, we can register it. Or do more fancy stuff like overriding the `_normalization`. We can however also get the full control of what our model output by directly overriding `_pdf`. The signature does not contain only `x` but additionally `norm_range`. This can have no limits (`norm_range.has_limits` is False), in which case the \"unnormalized pdf\" is requested. Otherwise, `norm_range` can have different limits and we have to take care of the proper normalization.\n", + "Before, we used `_unnormalized_pdf`, which is the common use-case. Even if we want to add an analytic integral, we can register it. Or do more fancy stuff like overriding the `_normalization`. We can however also get the full control of what our model output by directly overriding `_pdf`. The signature does not contain only `x` but additionally `norm`. This can have no limits (`norm.has_limits` is False), in which case the \"unnormalized pdf\" is requested. Otherwise, `norm` can have different limits and we have to take care of the proper normalization.\n", "\n", "This is usually not needed and inside zfit, all PDFs are implemented using the `_unnormalized_pdf`.\n", "\n", diff --git a/_website/tutorials/introduction/Introduction.ipynb b/_website/tutorials/introduction/Introduction.ipynb index 8fdeee8..4d1cf64 100644 --- a/_website/tutorials/introduction/Introduction.ipynb +++ b/_website/tutorials/introduction/Introduction.ipynb @@ -358,8 +358,8 @@ "\n", "PDFs provide a few useful methods. The main features of a zfit PDF are:\n", "\n", - "- `pdf`: the normalized value of the PDF. It takes an argument `norm_range` that can be set to `False`, in which case we retrieve the unnormalized value\n", - "- `integrate`: given a certain range, the PDF is integrated. As `pdf`, it takes a `norm_range` argument that integrates over the unnormalized `pdf` if set to `False`\n", + "- `pdf`: the normalized value of the PDF. It takes an argument `norm` that can be set to `False`, in which case we retrieve the unnormalized value\n", + "- `integrate`: given a certain range, the PDF is integrated. As `pdf`, it takes a `norm` argument that integrates over the unnormalized `pdf` if set to `False`\n", "- `sample`: samples from the pdf and returns a `Data` object" ] }, diff --git a/_website/tutorials/introduction/Introduction_long.ipynb b/_website/tutorials/introduction/Introduction_long.ipynb index c8fd9a1..be0c5a2 100644 --- a/_website/tutorials/introduction/Introduction_long.ipynb +++ b/_website/tutorials/introduction/Introduction_long.ipynb @@ -215,7 +215,7 @@ "\\mathrm{PDF}_{f(x)}(x; \\theta) = \\frac{f(x; \\theta)}{\\int_{a}^{b} f(x; \\theta)}\n", "\\end{align}\n", "\n", - "where a and b define the normalization range (`norm_range`), over which (by inserting into the above definition) the integral of the PDF is unity.\n", + "where a and b define the normalization range (`norm`), over which (by inserting into the above definition) the integral of the PDF is unity.\n", "\n", "zfit has a modular approach to things and this is also true for models. While the normalization itself (e.g. what are parameters, what is normalized data) will already be pre-defined in the model, models are composed of functions that are transparently called inside. For example, a Gaussian would usually be implemented by writing a Python function `def gauss(x, mu, sigma)`, which does not care about the normalization and then be wrapped in a PDF, where the normalization and what is a parameter is defined.\n", "\n", @@ -366,7 +366,7 @@ }, "outputs": [], "source": [ - "gauss.norm_range" + "gauss.norm" ] }, { @@ -377,7 +377,7 @@ } }, "source": [ - "As we've seen, the `obs` we defined is the `space` of Gauss: this acts as the default limits whenever needed (e.g. for sampling). `gauss` also has a `norm_range`, which equals by default as well to the `obs` given, however, we can explicitly change that with `set_norm_range`." + "As we've seen, the `obs` we defined is the `space` of Gauss: this acts as the default limits whenever needed (e.g. for sampling). `gauss` also has a `norm`, which equals by default as well to the `obs` given, however, we can explicitly change that with `set_norm`." ] }, { @@ -472,8 +472,8 @@ "\n", "PDFs provide a few useful methods. The main features of a zfit PDF are:\n", "\n", - "- `pdf`: the normalized value of the PDF. It takes an argument `norm_range` that can be set to `False`, in which case we retrieve the unnormalized value\n", - "- `integrate`: given a certain range, the PDF is integrated. As `pdf`, it takes a `norm_range` argument that integrates over the unnormalized `pdf` if set to `False`\n", + "- `pdf`: the normalized value of the PDF. It takes an argument `norm` that can be set to `False`, in which case we retrieve the unnormalized value\n", + "- `integrate`: given a certain range, the PDF is integrated. As `pdf`, it takes a `norm` argument that integrates over the unnormalized `pdf` if set to `False`\n", "- `sample`: samples from the pdf and returns a `Data` object" ] }, diff --git a/components/50 - Custom code and run mode.ipynb b/components/50 - Custom code and run mode.ipynb index 60fe262..fdad4c8 100644 --- a/components/50 - Custom code and run mode.ipynb +++ b/components/50 - Custom code and run mode.ipynb @@ -273,7 +273,7 @@ "This can be useful for debugging, as now every Tensor has a value and every operation is executed immediately.\n", "\n", "Another problem is that building a graph becomes only efficient if we execute it multiple times, not just a single time. But for plotting a pdf for example, just a single call to `pdf` is needed.\n", - "Furthermore, since different objects (e.g. different datasets, `norm_range` etc.) will create a new graph, things can become very slow, caching many graphs that often are not needed anymore.\n", + "Furthermore, since different objects (e.g. different datasets, `norm` etc.) will create a new graph, things can become very slow, caching many graphs that often are not needed anymore.\n", "\n", "The `z.function` decorator is in fact more powerful then the pure `tf.function`: it allow to tell what kind of function is wrapped and this on the other hand allows zfit to be \"smart\" about which function to trace and which not. By default, any method of models (`pdf`, `integrate`,...) are executed eagerly, without graphs. On the other hand, if a loss is built, this builds a graph of everything. Mainly, this behavior is wanted.\n", "\n", @@ -357,7 +357,7 @@ "source": [ "## Graph caching and slowness\n", "\n", - "Repeated calls to graph building functions are sometimes necessary, e.g. when scanning over a range and changing the `norm_range`, which renders the validity of the graph invalid. We can have a look at an example." + "Repeated calls to graph building functions are sometimes necessary, e.g. when scanning over a range and changing the `norm`, which renders the validity of the graph invalid. We can have a look at an example." ] }, { diff --git a/components/62 - Multidim Custom PDF.ipynb b/components/62 - Multidim Custom PDF.ipynb index b06f4bf..f81926b 100644 --- a/components/62 - Multidim Custom PDF.ipynb +++ b/components/62 - Multidim Custom PDF.ipynb @@ -119,7 +119,7 @@ "We could improve our PDF by registering an integral. This requires a few steps:\n", " - define our integral as a function in python\n", " - define in which space our integral is valid, e.g. whether it is an integral over all axis or only partial and whether any limit is valid or only special (e.g. from -inf to inf)\n", - " - register the integral and say if it supports additional things (e.g. norm_range)\n", + " - register the integral and say if it supports additional things (e.g. norm)\n", "\n", "Let's start defining the function. This takes, for an integral over all axes, three parameters:\n", " - limits: the actual limits the integral is over\n", diff --git a/guides/custom_models.ipynb b/guides/custom_models.ipynb index 4067316..55a3f60 100644 --- a/guides/custom_models.ipynb +++ b/guides/custom_models.ipynb @@ -166,8 +166,8 @@ " return limit + 0.5 * b * limit ** 2 + 1 / 3 * c * limit ** 3\n", "\n", "\n", - "def integral_func(limits, norm_range, params, model):\n", - " del norm_range, model # not needed\n", + "def integral_func(limits, norm, params, model):\n", + " del norm, model # not needed\n", "\n", " b = params['b']\n", " c = params['c']\n", @@ -466,7 +466,7 @@ "\n", "**To remember**: in order to have full control over a public function such as `integrate`, `pdf`, `sample` or `normalization`, the private method, e.g. `_integrate` can be overriden and is _guaranteed_ to be called before other possibilities.\n", "\n", - "In the case above, `pdf` called first `_pdf` (which is not implemented), so it calls `_unnormalized_pdf` and divides this by the `normalization`. The latter also does not have an explicit implementation (`_implementation`), so it uses the fallback and calls `integrate` over the `norm_range`. Since `_integrate` is not provided, the fallback tries to perform an analytic integral, which is not available. Therefore, it integrates the `_unnormalized_prob` numerically. In all of this calls, we can hook in by overriding the mentioned, specified methods.\n", + "In the case above, `pdf` called first `_pdf` (which is not implemented), so it calls `_unnormalized_pdf` and divides this by the `normalization`. The latter also does not have an explicit implementation (`_implementation`), so it uses the fallback and calls `integrate` over the `norm`. Since `_integrate` is not provided, the fallback tries to perform an analytic integral, which is not available. Therefore, it integrates the `_unnormalized_prob` numerically. In all of this calls, we can hook in by overriding the mentioned, specified methods.\n", "\n", "What we did not mention: `ZPDF` is just a wrapper around the actual `BasePDF` that should be preferred in general; it simply provides a convenient `__init__`. For the next example, we will implement a multidimensional PDF and use the custom `__init__`" ] @@ -481,7 +481,7 @@ "source": [ "### Overriding `pdf`\n", "\n", - "Before, we used `_unnormalized_pdf`, which is the common use-case. Even if we want to add an analytic integral, we can register it. Or do more fancy stuff like overriding the `_normalization`. We can however also get the full control of what our model output by directly overriding `_pdf`. The signature does not contain only `x` but additionally `norm_range`. This can have no limits (`norm_range.has_limits` is False), in which case the \"unnormalized pdf\" is requested. Otherwise, `norm_range` can have different limits and we have to take care of the proper normalization.\n", + "Before, we used `_unnormalized_pdf`, which is the common use-case. Even if we want to add an analytic integral, we can register it. Or do more fancy stuff like overriding the `_normalization`. We can however also get the full control of what our model output by directly overriding `_pdf`. The signature does not contain only `x` but additionally `norm`. This can have no limits (`norm.has_limits` is False), in which case the \"unnormalized pdf\" is requested. Otherwise, `norm` can have different limits and we have to take care of the proper normalization.\n", "\n", "This is usually not needed and inside zfit, all PDFs are implemented using the `_unnormalized_pdf`.\n", "\n", diff --git a/introduction/Introduction.ipynb b/introduction/Introduction.ipynb index 8fdeee8..4d1cf64 100644 --- a/introduction/Introduction.ipynb +++ b/introduction/Introduction.ipynb @@ -358,8 +358,8 @@ "\n", "PDFs provide a few useful methods. The main features of a zfit PDF are:\n", "\n", - "- `pdf`: the normalized value of the PDF. It takes an argument `norm_range` that can be set to `False`, in which case we retrieve the unnormalized value\n", - "- `integrate`: given a certain range, the PDF is integrated. As `pdf`, it takes a `norm_range` argument that integrates over the unnormalized `pdf` if set to `False`\n", + "- `pdf`: the normalized value of the PDF. It takes an argument `norm` that can be set to `False`, in which case we retrieve the unnormalized value\n", + "- `integrate`: given a certain range, the PDF is integrated. As `pdf`, it takes a `norm` argument that integrates over the unnormalized `pdf` if set to `False`\n", "- `sample`: samples from the pdf and returns a `Data` object" ] }, diff --git a/introduction/Introduction_long.ipynb b/introduction/Introduction_long.ipynb index c8fd9a1..be0c5a2 100644 --- a/introduction/Introduction_long.ipynb +++ b/introduction/Introduction_long.ipynb @@ -215,7 +215,7 @@ "\\mathrm{PDF}_{f(x)}(x; \\theta) = \\frac{f(x; \\theta)}{\\int_{a}^{b} f(x; \\theta)}\n", "\\end{align}\n", "\n", - "where a and b define the normalization range (`norm_range`), over which (by inserting into the above definition) the integral of the PDF is unity.\n", + "where a and b define the normalization range (`norm`), over which (by inserting into the above definition) the integral of the PDF is unity.\n", "\n", "zfit has a modular approach to things and this is also true for models. While the normalization itself (e.g. what are parameters, what is normalized data) will already be pre-defined in the model, models are composed of functions that are transparently called inside. For example, a Gaussian would usually be implemented by writing a Python function `def gauss(x, mu, sigma)`, which does not care about the normalization and then be wrapped in a PDF, where the normalization and what is a parameter is defined.\n", "\n", @@ -366,7 +366,7 @@ }, "outputs": [], "source": [ - "gauss.norm_range" + "gauss.norm" ] }, { @@ -377,7 +377,7 @@ } }, "source": [ - "As we've seen, the `obs` we defined is the `space` of Gauss: this acts as the default limits whenever needed (e.g. for sampling). `gauss` also has a `norm_range`, which equals by default as well to the `obs` given, however, we can explicitly change that with `set_norm_range`." + "As we've seen, the `obs` we defined is the `space` of Gauss: this acts as the default limits whenever needed (e.g. for sampling). `gauss` also has a `norm`, which equals by default as well to the `obs` given, however, we can explicitly change that with `set_norm`." ] }, { @@ -472,8 +472,8 @@ "\n", "PDFs provide a few useful methods. The main features of a zfit PDF are:\n", "\n", - "- `pdf`: the normalized value of the PDF. It takes an argument `norm_range` that can be set to `False`, in which case we retrieve the unnormalized value\n", - "- `integrate`: given a certain range, the PDF is integrated. As `pdf`, it takes a `norm_range` argument that integrates over the unnormalized `pdf` if set to `False`\n", + "- `pdf`: the normalized value of the PDF. It takes an argument `norm` that can be set to `False`, in which case we retrieve the unnormalized value\n", + "- `integrate`: given a certain range, the PDF is integrated. As `pdf`, it takes a `norm` argument that integrates over the unnormalized `pdf` if set to `False`\n", "- `sample`: samples from the pdf and returns a `Data` object" ] },