Poisson

class pyhf.probability.Poisson(rate)[source]

Bases: pyhf.probability._SimpleDistributionMixin

The Poisson distribution with rate parameter rate.

Example

>>> import pyhf
>>> rates = pyhf.tensorlib.astensor([5, 8])
>>> pyhf.probability.Poisson(rates)
<pyhf.probability.Poisson object at 0x...>

Methods

__init__(rate)[source]
Parameters

rate (tensor or float) – The mean of the Poisson distribution (the expected number of events)

expected_data()[source]

The expectation value of the Poisson distribution.

Example

>>> import pyhf
>>> rates = pyhf.tensorlib.astensor([5, 8])
>>> poissons = pyhf.probability.Poisson(rates)
>>> poissons.expected_data()
array([5., 8.])
Returns

The mean of the Poisson distribution (which is the rate)

Return type

Tensor

log_prob(value)

The log of the probability density function at the given value.

Parameters

value (tensor or float) – The value at which to evaluate the distribution

Returns

The value of \(\log(f\left(x\middle|\theta\right))\) for \(x=\)value

Return type

Tensor

sample(sample_shape=())

The collection of values sampled from the probability density function.

Parameters

sample_shape (tuple) – The shape of the sample to be returned

Returns

The values \(x \sim f(\theta)\) where \(x\) has shape sample_shape

Return type

Tensor