jonas-eschle on develop
docs: update CHANGELOG.rst for … (compare)
jonas-eschle on binned_new
chore: add benchmark in require… (compare)
jonas-eschle on binned_new
fix: unsupported format type (compare)
jonas-eschle on binned_new
fix: unsupported format type (compare)
jonas-eschle on binned_new
debug: add statement to check n… (compare)
jonas-eschle on binned_new
[pre-commit.ci] pre-commit auto… Merge pull request #368 from zf… Merge branch 'develop' into bin… (compare)
jonas-eschle on binned_new
docs: add docs for binned data enh: add chi2 docs and options … (compare)
I am investigating it, many thanks for the example. One thing that is also more generally of interest: especially for smaller fits, you can also try to run things in eager mode, e.g. to do:
zfit.run.set_graph_mode(False)
...
which runs zfit in a numpy-like mode. This can be faster for only a few fits and usually does not have memory grow (True; in your case, having multiple fits, it should be faster with the default, I am investigating)
In addition, I am not sure how to import partial integral. I have seen several examples but they are all full integral.
Hi, this is possible indeed! I've added an explanation in the development wiki about the logic. In short, you can register it as you do and there is an example available (also mentioned in the wiki)
Thank you, that really helps!
Double_t ret = 9./(323.14159265) (
0.75(1-Fl) intPart[0]
+ Fl * intPart[1]
+ 0.25*(1-Fl) * intPart[2]
- Fl * intPart[3]
+ 0.5*P1*(1-Fl) * intPart[4]
+ 0.5*sqrt(Fl-Fl*Fl)*P4p * intPart[5]
+ sqrt(Fl-Fl*Fl)*P5p * intPart[6]
- sqrt(Fl-Fl*Fl)*P6p * intPart[7]
+ 0.5*sqrt(Fl-Fl*Fl)*P8p * intPart[8]
+ 2*(1-Fl)*P2 * intPart[9]
- P3*(1-Fl) * intPart[10]
);
I want to import the integral like this formula. So we need to add the intPart histogram in the integral function. I want to know how to do this
Hi all! A collaborator I'm working with just installed zfit
, but when doing an import is getting the error message:
AttributeError: module 'iminuit.util' has no attribute 'MigradResult'
Are there changes on the iminuit
side that affect zfit
? I can ask him for more details of his package versions e.t.c. if required. Thanks a lot!
MigradResult
was removed.
I've just tried it and it install the correct version. Otherwise, he can simply downgrade iminuit with `pip install "iminuit<2"
It's true that iminuit 2 is out and there have been quite a few changes to it
Hi all. I'm wanting to save as much output pertaining to the fit result and the validity of the minimum found as possible. I see that I can access the (iminuit) information by doing something like:
minimum_info = dict(result.info["original"])
Where "result" is a FitResult instance.
Am I missing a more direct function implemented in zfit?
Indeed, this is most there is, as the common interface is shared by multiple minimizers and therefore does not provide all the detailed information that e.g. iminuit provides. But if you have a good idea on what to add, feel free to propose, that can indeed be helpful. What else you should currently find is:
result.edm
result.params_at_limit
result.valid
( which checks also params_at_limit)result.converged
result.fmin
(value of function at minimum)Just let us know (open an issue) if you think there are more things that should be propagated from the minimizer
Yes, in fact it is already upgraded in the develop version that will be a new "majorish" release, 0.6.0. If you want, you can install the current dev version withpip install git+https://github.com/zfit/zfit
Furthermore, there will be a general large upgrade on minimizers, adding SciPy and NLopt with a complete overhaul of the mechanics (currently a PR).
import zfit
from zfit import z
import numpy as np
import tensorflow as tf
zfit.run.set_autograd_mode(False)
class BinnedEfficiencyPDF(zfit.pdf.BasePDF):
def __init__(self, efficiency, eff_bins, obs, name='BinnedEfficiencyPDF'):
self.efficiency = efficiency
self.eff_bins = eff_bins
super().__init__(obs=obs, name=name)
def _bin_content(self, x):
eff_bin = np.digitize(x, self.eff_bins)
return self.efficiency[eff_bin]
def _unnormalized_pdf(self, x): # or even try with PDF
x = z.unstack_x(x)
probs = z.py_function(func=self._bin_content, inp=[x], Tout=tf.float64)
probs.set_shape(x.shape)
return probs
set_yield(...)
works
FFTConvPDFV1
) in zfit. How might I use FFTConvPDFV1
, to create a PDF equivalent to the Voigtian
in RooFit? I tried creating a new instance with the kernel set to a Gaussian and func
to the RBW from the zfit_physics
/ bw
branch, but it seems I cannot use this straightaway. Is there something I'm missing?
We've released the 0.6 series of zfit! Major addition is a lot of new minimizers that all support uncertainty estimations the same way as used now.
They can now be invoked independent of zfit models at all and used with pure Python functions
The main changes (full changelog here
Added many new minimizers. A full list can be found in :ref:minimize_user_api
.
IpyoptV1
that wraps the powerful Ipopt large scale minimization libraryScipyLBFGSBV1
, or ScipySLSQPV1
NLoptLBFGSV1
, NLoptTruncNewtonV1
orNLoptMMAV1
but also includes more global minimizers such asNLoptMLSLV1
and NLoptESCHV1
.Completely new and overhauled minimizers design, including:
init
to minimize
Major overhaul of the FitResult
, including:
zfit_error
(equivalent of MINOS
)minuit_hesse
and minuit_minos
are now available with all minimizers as well thanks to an greatapprox
hesse that returns the approximate hessian (if available, otherwise empty)Hey @mayou36! :)
I wrote to you regarding GSoC 2021 (via aman.goel185@gmail.com) , and have a doubt regarding the same in the evaluation task.
Can I contact you over private chat?
We released multiple small releases up to 0.6.3 with a few minor improvements and bugfixes. Make sure to upgrade to the latest version using
pip install -U zfit
Thanks to the finders of the bugs. We appreciate any kind of (informal) feedback, ideas or bugs, feel free to reach out to us anytime with anything
Hi. I am intensively using zfit in notebooks, and I have been running into the well-known NameAlreadyTakenErrors. I have found workarounds that work for me, but I just wanted to say that it seems to me the example presented in here does not work. Like, if you try to use this you will get an error when minimising:
~/.local/lib/python3.6/site-packages/zfit/minimizers/minimizer_minuit.py in <listcomp>(.0)
76 errors = tuple(param.step_size for param in params)
77 start_values = [p.numpy() for p in params]
---> 78 limits = [(low.numpy(), up.numpy()) for low, up in limits]
79 errors = [err.numpy() for err in errors]
80
AttributeError: 'int' object has no attribute 'numpy'
I guess the problem is that the limits are supposed to be tf.Tensor
, but if we simply assign a float
or int
via param.lower
or param.upper
that breaks the code later?
Couldn't there be some sort of a method, such as set_limit_lower(value)
? Or am I misusing zfit somehow?
Hi, to overload the parameters in Jupyter, does the following way work?
iCell = get_ipython().execution_count #get the current cell number
par1 = zfit.Parameter("par1"+str(iCell), 8., 0., 20.)
par2 = zfit.Parameter("par2"+str(iCell), -20., -50., 50.)
par3 = zfit.Parameter("par3_"+str(iCell), 10., 0., 20.)