spey.backends.default_pdf.DefaultPDFBase#
- class spey.backends.default_pdf.DefaultPDFBase(signal_yields: ndarray, background_yields: ndarray, data: ndarray, covariance_matrix: ndarray | Callable[[ndarray], ndarray] | None = None, signal_uncertainty_configuration: Dict[str, Any] | None = None)[source]#
Default PDF backend base
- Parameters:
signal_yields (
np.ndarray) – signal yieldsbackground_yields (
np.ndarray) – background yieldsdata (
np.ndarray) – observed yieldscovariance_matrix (
np.ndarray) –covariance matrix. The dimensionality of each axis has to match with
background_yields,signal_yields, anddatainputs.Warning
The diagonal terms of the covariance matrix involves squared absolute background uncertainties. In case of uncorralated bins user should provide a diagonal matrix with squared background uncertainties.
signal_uncertainty_configuration (
Dict[Text, Any]], defaultNone) –Configuration input for signal uncertainties
absolute_uncertainties (
List[float]): Absolute uncertainties for the signal- absolute_uncertainty_envelops (
List[Tuple[float, float]]): upper and lower uncertainty envelops
- absolute_uncertainty_envelops (
correlation_matrix (
List[List[float]]): Correlation matrixthird_moments (
List[float]): diagonal elemetns of the third moment
Note
To enable a differentiable statistical model, all inputs are wrapped with
autograd.numpy.array()function.- __init__(signal_yields: ndarray, background_yields: ndarray, data: ndarray, covariance_matrix: ndarray | Callable[[ndarray], ndarray] | None = None, signal_uncertainty_configuration: Dict[str, Any] | None = None)[source]#
Methods
__init__(signal_yields, background_yields, data)asimov_negative_loglikelihood([poi_test, ...])Compute negative log-likelihood at fixed \(\mu\) for Asimov data.
combine(other, **kwargs)A routine to combine to statistical models.
config([allow_negative_signal, poi_upper_bound])Model configuration.
expected_data(pars[, include_auxiliary])Compute the expected value of the statistical model
get_hessian_logpdf_func([expected, data])Currently Hessian of \(\log\mathcal{L}(\mu, \theta)\) is only used to compute variance on \(\mu\).
get_logpdf_func([expected, data])Generate function to compute \(\log\mathcal{L}(\mu, \theta)\) where \(\mu\) is the parameter of interest and \(\theta\) are nuisance parameters.
get_objective_function([expected, data, do_grad])Objective function i.e. twice negative log-likelihood, \(-2\log\mathcal{L}(\mu, \theta)\).
get_sampler(pars)Retreives the function to sample from.
minimize_asimov_negative_loglikelihood([...])A backend specific method to minimize negative log-likelihood for Asimov data.
minimize_negative_loglikelihood([expected, ...])A backend specific method to minimize negative log-likelihood.
negative_loglikelihood([poi_test, expected])Backend specific method to compute negative log-likelihood for a parameter of interest \(\mu\).
Attributes
constraintsConstraints to be used during optimisation process
signal_uncertainty_configurationauthorAuthor of the backend
constraint_modelretreive constraint model distribution
is_aliveReturns True if at least one bin has non-zero signal yield.
main_modelretreive the main model distribution
nameName of the backend
spey_requiresSpey version required for the backend
versionVersion of the backend