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)
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
create_extended
, you can also make a PDF extended in-place by using pdf.set_yield()
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.)
Hi again :) I was wondering if there is a way to have a parameter which has its upper limit depending on another parameter. As a naive illustration, imagine you are fitting a quadratic parabola ax**2+bx+c, and you want the peak of the parabola to be between 0 and 5. The would mean 0<-b/2a<5.
I naively tried something similar to this:
a = zfit.Parameter("a", 5, floating=True)
b = zfit.Parameter("b", 0, lower = -10*a, floating=True)
However, it seems that all this does is sets the upper limit to be at -10 * initial value of a. Is there a way to somehow change limit to the value as a is changing?
A new zfit version, 0.8x series is available, with bugfixes, improved numerical integration and different Kernel Density Estimations (also for large sample sizes).
The tutorials also improved in the style and have now their own site. They can be run interactively, or downloaded, or be viewed.