Questions tagged [zfit]

zfit: scalable pythonic fitting

The zfit package is a model manipulation and fitting library based on TensorFlow and optimised for simple and direct manipulation of probability density functions. Its main focus is on scalability, parallelisation and user friendly experience. It integrates well into the scientific Python ecosystem and provides an alternative to the current fitting libraries, especially the ones used in High Energy Physics.

20 questions
2
votes
1 answer

Error estimation of maximum likelihood fit in zfit with weight

I am looking at the zfit tutorial, and seeing the comment about the likelihood with weight, (see attached image) does anyone know if how the uncertainty is estimated in this case. How would the weight contribute here? Thanks in advance!
peilian
  • 21
  • 1
2
votes
1 answer

Pull plot from toys in zFit

First of all I would like to say that I do have conceptual difficulties with this topic, so please correct me if my intention does not make sense. I'm trying to validate the model that I use to extract the signal yield from a distribution. For…
2
votes
1 answer

Import dataset from a ROOT file with cut using zfit

I am trying to perform a fit to a tree. But I need to add some cut to the branches which are not the observables of the fit. Website https://zfit.readthedocs.io/en/latest/getting_started/intro/data.html tells me that I can include cuts in the…
Xuelong
  • 21
  • 1
2
votes
2 answers

Use of data with negative weights in unbinned maximum likelihood fit in zfit

I am trying to perform an unbinned 3D angular fit in zfit, where the input data is a sample with per-event sWeights assigned from a separate invariant mass peak fit. I think I'm running into issues of negatively weighted events in some regions of…
dhill89
  • 61
  • 4
2
votes
1 answer

Is there way to extend predefined polynomial pdf in zfit?

​I'm trying to perform a fit with extended Chebyshev pdf. To do so I use predefined zfit.pdf.Chebyshev(). What do I miss here? import tensorflow as tf import zfit from zfit import ztf obs = zfit.Space('mass', limits=(-1000., 1000.)) slope =…
serhiiC
  • 23
  • 3
2
votes
1 answer

Multiple limits in fitting and toy generation in zfit

I have a running model with a pdf in zfit from where I want to generate toys from and after also fit the pdf to the toys. However I was wondering how to exclude certain areas in the toy generation as well as in the fitting after. More clear this…
Dovahkinsl
  • 21
  • 1
1
vote
1 answer

Problems creating a customized pdf; asymmetric gaussian

In order to create a customized pdf in zfit; Skew normal distribution (asymmetric gaussian), how can be called the error function? Seems that math.erf(x) and scipy.special.erf(x) do not works (they are tensor-like ones). This is my code: class…
1
vote
1 answer

zfit hesse function error: "RuntimeWarning: Exception occurred, parameter values are not reset and in an arbitrary, last used state."

When playing with zfit tutorial, I just tried to remove the floating option of the alpha_sig parameter. In other words, I changed alpha_sig = zfit.Parameter('alpha_sig', 200, 100, 400, floating=False) to alpha_sig = zfit.Parameter('alpha_sig', 200,…
gtateno
  • 11
  • 2
1
vote
1 answer

Exclude/Ignore data region in polynomial fit (zfit)

I wanted to know if there's a way to exclude one or more data regions in a polynomial fit. Currently this doesn't seem to work as I would expect. Here a small example: import numpy as np import pandas as pd import zfit # Create test data left_data…
lweid
  • 13
  • 2
1
vote
1 answer

How can I convert a histogram (2D) into 2 pdf in zfit?

I am trying to do some 2d spectra fitting with the help of zfit. The pdf I want to use comes from ROOT TH2D. Is there any method to convert the input Th2D into a 2D pdf directly in zfit? Thanks a lot!
YMTheory
  • 13
  • 2
1
vote
1 answer

PDF from a histogram in zfit?

I looking in the documentation how to obtain a PDF from a histogram, but I couldn't find anything, so how can I obtain PDF from a histogram ?, for example to use it in a sum_pdf = zfit.pdf.SumPDF([model1, model2], fracs=frac) in order to perfome a…
Marchela04
  • 144
  • 8
1
vote
1 answer

Constrain on parameters for Negative Log Likelihood Minimization

I am trying to fit a 5 parameter (a, b, c, d, e) model, where one of the parameters is constrained by another, let's say, 0< d < 1 e < |d| I am currently using zfit which as far as I know, uses iMinuit I have only created the zfit.Parameters and put…
Horace
  • 62
  • 4
1
vote
1 answer

Why is __future__.annotations (PEP 563) not backported to python3.6?

Does anyone know why PEP 563 is not backported to python36 as of the time of this writing? Are there any plans to do that or is it even possible? I am asking because I could use it for the codebase of zfit which currently supports py36 through py38…
SebastianJL
  • 169
  • 1
  • 1
  • 8
1
vote
1 answer

Accessing PDF variables when registering analytic integral

Firstly, thank you for making a really neat, pythonic tool which can be used as an alternative for RooFit. I have successfully defined a custom 2D PDF but I am not completely sure on how to register my function's analytic integral: Analytic…
0
votes
1 answer

How can I obtain sWeights with zfit?

I have a fit to the signal region using zfit and fitting with an ExtendedUnbinnedNLL. My models are a signal and a background PDF. How can I obtain the sWeights for background subtraction? I had a look already at hepstats, they seem to provide many…
Mayou36
  • 4,613
  • 2
  • 17
  • 20
1
2