spey.backends.default_pdf.simple_pdf.SimplePDFBase#
- class spey.backends.default_pdf.simple_pdf.SimplePDFBase(signal_yields: List[float] | Callable[[ndarray], ndarray], background_yields: List[float], data: List[int], n_signal_parameters: int = 0, signal_parameter_bounds: List[Tuple[float | None, float | None]] | None = None)[source]#
Abstract base class for nuisance-free (simple) PDF backends.
Subclasses implement statistical models in which the expected bin counts depend only on the signal strength \(\mu\),
\[\lambda_i(\mu) = \mu\, n^s_i + n^b_i,\]with no systematic nuisance parameters entering the fit (or, in the case of
Poissonwithabsolute_uncertainties, unconstrained nuisances that are marginalised by the optimiser without an explicit constraint model).This class provides:
Common storage and
autograd-compatible array initialisation.Minimum-POI computation: \(\mu_{\min} = -\min_{i} n^b_i / n^s_i\) over bins with \(n^s_i > 0\).
A lazily-initialised
main_modelproperty based on the \(\lambda(\mu)\) function above.Default implementations of
get_objective_function(),get_logpdf_func(),get_hessian_logpdf_func(),get_sampler(), andexpected_data()that all delegate tomain_model.
Subclasses customise the model by overriding
main_model(by settingself._main_modeldirectly in__init__) and by passingself._main_kwargsto change the distribution type used byMainModel.- __init__(signal_yields: List[float] | Callable[[ndarray], ndarray], background_yields: List[float], data: List[int], n_signal_parameters: int = 0, signal_parameter_bounds: List[Tuple[float | None, float | None]] | None = None)[source]#
Methods
__init__(signal_yields, background_yields, data)asimov_negative_loglikelihood([poi_test, ...])Compute the profiled negative log-likelihood at fixed \(\mu\) on Asimov data.
combine(other, **kwargs)Combine this statistical model with another backend instance.
config([allow_negative_signal, poi_upper_bound])Model configuration.
expected_data(pars, **kwargs)Compute the expected data vector \(\{\lambda_i(\mu)\}\) at the given parameter point.
get_hessian_logpdf_func([expected, data])Return a callable that evaluates the Hessian of \(\ln\mathcal{L}(\mu)\).
get_logpdf_func([expected, data])Return a callable that evaluates \(\ln\mathcal{L}(\mu)\).
get_objective_function([expected, data, do_grad])Return the objective function \(-\ln\mathcal{L}(\mu)\) used by the optimiser.
get_sampler(pars)Return a callable that draws pseudo-data from the main model.
minimize_asimov_negative_loglikelihood([...])Find the global minimum of the negative log-likelihood on Asimov data (free fit).
minimize_negative_loglikelihood([expected, ...])Find the global minimum of the negative log-likelihood (free fit).
negative_loglikelihood([poi_test, expected])Compute the profiled negative log-likelihood at a fixed \(\mu\).
Attributes
datasignal_yieldsbackground_yieldsauthorAuthor of the backend
is_aliveReturns True if at least one bin has non-zero signal yield.
main_modelMain model distribution — Poisson (or Gaussian) term of the likelihood.
nameName of the backend
spey_requiresSpey version required for the backend
versionVersion of the backend
constraintsConstraints to be used during optimisation process
n_signal_parametersNumber of signal parameters