pyhf#
The pure Python package pyhf is a statistical fitting package for high energy physics for purely binned, templated fits. It is a Python implementation of the HistFactory schema. The connection to zfit is done via the loss function, which can be created from a pyhf model.
Import the module with:
import zfit_physics.pyhf as zpyhf
The loss function can be created from a data and a pdf model with
nll = zpyhf.loss.nll_from_pyhf(data, pdf)
which optionally takes already created ZfitParameter as arguments.
Loss#
- zfit_physics.pyhf.loss.nll_from_pyhf(data, pdf, *, params=None, init_pars=None, par_bounds=None, fixed_params=None, errordef=None)[source]#
Create a zfit loss function from a pyhf pdf and data.
- Parameters:
data – Data to be used in the negative log-likelihood (NLL) calculation.
pdf – Probability density function model.
params – Optional; Model parameters for the fit. If None, initial parameters, bounds, and fixed status are recommended by the pdf.
init_pars – Optional; Initial parameter values. Ignored if params is provided.
par_bounds – Optional; Parameter bounds. Ignored if params is provided.
fixed_params – Optional; Boolean indicators of parameter fixed statuses. Ignored if params is provided.
errordef – Optional; Error definition, by default set to 0.5.