_MainModel#
- class pyhf.pdf._MainModel(config, modifiers, nominal_rates, batch_size=None, clip_sample_data: float | None = None, clip_bin_data: float | None = None)[source]#
Bases:
object
Factory class to create pdfs for the main measurement.
- __init__(config, modifiers, nominal_rates, batch_size=None, clip_sample_data: float | None = None, clip_bin_data: float | None = None)[source]#
Methods
- expected_data(pars, return_by_sample=False)[source]#
Compute the expected rates for given values of parameters.
For a single channel single sample, we compute:
Pois(d | fac(pars) * (delta(pars) + nom) ) * Gaus(a | pars[is_gaus], sigmas) * Pois(a * cfac | pars[is_poi] * cfac)
- where:
delta(pars) is the result of an apply(pars) of combined modifiers with ‘addition’ op_code
factor(pars) is the result of apply(pars) of combined modifiers with ‘multiplication’ op_code
pars[is_gaus] are the subset of parameters that are constrained by gauss (with sigmas accordingly, some of which are computed by modifiers)
pars[is_pois] are the poissons and their rates (they come with their own additional factors unrelated to factor(pars) which are also computed by the finalize() of the modifier)
So in the end we only make 3 calls to pdfs
The pdf of data and modified rates
All Gaussian constraint as one call
All Poisson constraints as one call
- has_pdf()[source]#
Indicate whether the main model exists.
- Returns:
Whether the model has a Main Model component (yes it does)
- Return type:
Bool
- logpdf(maindata, pars)[source]#
Compute the logarithm of the value of the probability density.
- Parameters:
maindata (
tensor
) – The main channel data (a subset of the full data in a HistFactory model)pars (
tensor
) – The model parameters
- Returns:
The log of the pdf value
- Return type:
Tensor