Zfit

Latest version: v0.20.3

Safety actively analyzes 629959 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 9 of 11

0.5.0

Complete refactoring of Spaces to allow arbitrary function.
New, more consistent behavior with extended PDFs.
SumPDF refactoring, more explicit handling of fracs and yields.
Improved graph building allowing for more fine-grained control of tracing.
Stabilized minimization including a push-back for NaNs.



Major Features and Improvements
-------------------------------
- Arbitrary limits as well as vectorization (experimental)
are now fully supported. The new ``Space`` has an additional argument for a function that
tests if a vector x is inside.

To test if a value is inside a space, ``Space.inside`` can be used. To filter values, ``Space.filter``.

The limits returned are now by default numpy arrays with the shape ``(1, n_obs)``. This corresponds well
to the old layout and can, using ``z.unstack_x(lower)`` be treated like ``Data``. This has also some
consequences for the output format of ``rect_area``: this is now a vector.

Due to the ambiguity of the name ``limits``, ``area`` etc (since they do only reflect the rectangular case)
method with leading ``rect_*`` have been added (``rect_limits``, ``rect_area`` etc.) and are encouraged to be used.

- Extending a PDF is more straightforward and removes any "magic". The philosophy is: a PDF can be extended
or not. But it does not change the fundamental behavior of functions.

- SumPDF has been refactored and behaves now as follows:
Giving in pdfs (extended or not or mixed) *and* fracs (either length pdfs or one less) will create a
non-extended SumPDF using the fracs. The fact that the pdfs are maybe extended is ignored.
This will lead to highly consistent behavior.
If the number of fracs given equals the number of pdfs, it is up to the user (currently) to take care of
the normalization.
*Only* if *all* pdfs are extended **and** no fracs are given, the sumpdf will be using the yields as
normalized fracs and be extended.

- Improved graph building and ``z.function``

* the ``z.function`` can now, as with ``tf.function``, be used either as a decorator without arguments or as a
decorator with arguments. They are the same as in ``tf.function``, except of a few additional ones.
* ``zfit.run.set_mode`` allows to set the policy for whether everything is run in eager mode (``graph=False``),
everything in graph, or most of it (``graph=True``) or an optimized variant, doing graph building only with
losses but not just models (e.g. ``pdf`` won't trigger a graph build, ``loss.value()`` will) with ``graph='auto'``.
* The graph cache can be cleaned manually using ``zfit.run.clear_graph_cache()`` in order to prevent slowness
in repeated tasks.

- Switch for numerical gradients has been added as well in ``zfit.run.set_mode(autograd=True/False)``.
- Resetting to the default can be done with ``zfit.run.set_mode_default()``
- Improved stability of minimizer by adding penalty (currently in ``Minuit``) as default. To have a
better behavior with toys (e.g. never fail on NaNs but return an invalid ``FitResult``), use the
``DefaultToyStrategy`` in ``zfit.mnimize``.
- Exceptions are now publicly available in ``zfit.exception``
- Added nice printout for ``FitResult`` and ``FitResult.params``.
- ``get_params`` is now more meaningful, returning by default all independent parameters of the pdf, including yields.
Arguments (``floating``, ``is_yield``) allow for more fine-grained control.

Breaking changes
------------------
- Multiple limits are now handled by a MultiSpace class. Each Space has only "one limit"
and no complicated layout has to be remembered. If you want to have a space that is
defined in disconnected regions, use the ``+`` operator or functionally ``zfit.dimension.add_spaces``

To extract limits from multiple limits, ``MultiSpace`` and ``Space`` are both iterables, returning
the containing spaces respectively itself (for the ``Space`` case).
- SumPDF changed in the behavior. Read above in the Major Features and Improvement.
- Integrals of extended PDFs are not extended anymore, but ``ext_integrate`` now returns the
integral multiplied by the yield.

Deprecations
-------------
- ``ComposedParameter`` takes now ``params`` instead of ``dependents`` as argument, it acts now as
the arguments to the ``value_fn``. To stay future compatible, create e.g. ``def value_fn(p1, pa2)``
and using ``params = ['param1, param2]``, ``value_fn`` will then be called as ``value_fn(param1, parma2)``.
``value_fn`` without arguments will probably break in the future.
- ``FitResult.error`` has been renamed to ``errors`` to better reflect that multiple errors, the lower and
upper are returned.


Bug fixes and small changes
---------------------------
- fix a (nasty, rounding) bug in sampling with multiple limits
- fix bug in numerical calculation
- fix bug in SimplePDF
- fix wrong caching signature may lead to graph not being rebuild
- add ``zfit.param.set_values`` method that allows to set the values of multiple
parameters with one command. Can, as the ``set_value`` method be used with a context manager.
- wrong size of weights when applying cuts in a dataset
- ``with_coords`` did drop axes/obs
- Fix function not traced when an error was raised during first trace
- MultipleLimits support for analytic integrals
- ``zfit.param.set_values(..)`` now also can use a ``FitResult`` as ``values`` argument to set the values
from.

Experimental
------------
- added a new error method, ``'zfit_error'`` that is equivalent to ``'minuit_minos'``, but not fully
stable. It can be used with other minimizers as well, not only Minuit.

Requirement changes
-------------------
- remove the outdated typing module
- add tableformatter, colored, colorama for colored table printout

Thanks
------
- Johannes Lade for code review and discussions.
- Hans Dembinski for useful inputs to the uncertainties.

0.4.3

=================


Major Features and Improvements
-------------------------------

- refactor ``hesse_np`` with covariance matrix, make it available to all minimizers

Behavioral changes
------------------


Bug fixes and small changes
---------------------------

- fix bug in ``hesse_np``


Requirement changes
-------------------


Thanks
------

0.4.2

=================


Major Features and Improvements
-------------------------------

- Refactoring of the Constraints, dividing into ``ProbabilityConstraint`` that can be
sampled from and more general constraints (e.g. for parameter boundaries) that
can not be sampled from.
- Doc improvements in the constraints.
- Add ``hesse`` error method ('hesse_np') available to all minimizers (not just Minuit).


Behavioral changes
------------------
- Changed default step size to an adaptive scheme, a fraction (1e-4) of the range between the lower and upper limits.


Bug fixes and small changes
---------------------------
- Add ``use_minuit_grad`` option to Minuit optimizer to use the internal gradient, often for more stable fits
- added experimental flag ``zfit.experimental_loss_penalty_nan``, which adds a penalty to the loss in case the value is
nan. Can help with the optimisation. Feedback welcome!

Requirement changes
-------------------


Thanks
------

0.4.1

===============

0.4.0

===================

0.3.7

================

This is a legacy release to add some fixes, next release is TF 2 eager mode only release.


Major Features and Improvements
-------------------------------
- mostly TF 2.0 compatibility in graph mode, tests against 1.x and 2.x

Behavioral changes
------------------

Bug fixes and small changes
---------------------------
- ``get_depentents`` returns now an OrderedSet
- errordef is now a (hidden) attribute and can be changed
- fix bug in polynomials


Requirement changes
-------------------
- added ordered-set

Page 9 of 11

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.