spey.backends.default_pdf.simple_pdf.Gaussian

spey.backends.default_pdf.simple_pdf.Gaussian#

class spey.backends.default_pdf.simple_pdf.Gaussian(signal_yields: List[float] | Callable[[ndarray], ndarray], background_yields: List[float], data: List[int], absolute_uncertainties: List[float], n_signal_parameters: int = 0, signal_parameter_bounds: List[Tuple[float | None, float | None]] | None = None)[source]#

Product of independent Gaussians — uncorrelated normal likelihood (default.normal).

This backend replaces the Poisson term with a Gaussian approximation, which is accurate when the expected counts are large. The likelihood is

\[\mathcal{L}(\mu) = \prod_{i=1}^{N} \frac{1}{\sigma_i \sqrt{2\pi}} \exp\!\left[-\frac{(\mu n^s_i + n^b_i - n^{\rm obs}_i)^2} {2\sigma_i^2}\right],\]

where \(\sigma_i\) is the absolute uncertainty in bin \(i\).

Because the bins are independent this is equivalent to a \(\chi^2\) goodness-of-fit test with the total prediction \(\mu n^s_i + n^b_i\) as the hypothesis.

Added in version 0.1.9.

Parameters:
  • signal_yields (List[float]) – Per-bin signal yields \(\{n^s_i\}\).

  • background_yields (List[float]) – Per-bin expected background yields \(\{n^b_i\}\).

  • data (List[int]) – Per-bin observed counts \(\{n^{\rm obs}_i\}\).

  • absolute_uncertainties (List[float]) – Per-bin absolute uncertainties \(\{\sigma_i\}\) that enter the Gaussian widths.

  • n_signal_parameters (int, default 0) – number of additional free parameters to pass to a callable signal_yields. Has no effect when signal_yields is a plain array. When greater than zero the optimiser parameter vector is extended to [mu, signal_par_0, ..., signal_par_{n-1}].

  • signal_parameter_bounds (List[Tuple[Optional[float], Optional[float]]] | None) – Optimiser bounds for each extra signal parameter. Each entry is a (lower, upper) pair; use None for an unbounded side. When None, every extra signal parameter receives (None, None). Must have exactly n_signal_parameters entries when provided.

__init__(signal_yields: List[float] | Callable[[ndarray], ndarray], background_yields: List[float], data: List[int], absolute_uncertainties: List[float], n_signal_parameters: int = 0, signal_parameter_bounds: List[Tuple[float | None, float | None]] | None = None)[source]#

Methods

__init__(signal_yields, background_yields, ...)

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

absolute_uncertainties

absolute uncertainties on the background

author

Author of the backend

background_yields

data

is_alive

Returns True if at least one bin has non-zero signal yield.

main_model

Main model distribution — Poisson (or Gaussian) term of the likelihood.

name

Name of the backend

signal_yields

spey_requires

Spey version required for the backend

version

Version of the backend

constraints

Constraints to be used during optimisation process

n_signal_parameters

Number of signal parameters