Normal

class pyhf.probability.Normal(loc, scale)[source]

Bases: pyhf.probability._SimpleDistributionMixin

The Normal distribution with mean loc and standard deviation scale.

Example

>>> import pyhf
>>> means = pyhf.tensorlib.astensor([5, 8])
>>> stds = pyhf.tensorlib.astensor([1, 0.5])
>>> pyhf.probability.Normal(means, stds)
<pyhf.probability.Normal object at 0x...>

Methods

__init__(loc, scale)[source]
Parameters
  • loc (tensor or float) – The mean of the Normal distribution

  • scale (tensor or float) – The standard deviation of the Normal distribution

expected_data()[source]

The expectation value of the Normal distribution.

Example

>>> import pyhf
>>> means = pyhf.tensorlib.astensor([5, 8])
>>> stds = pyhf.tensorlib.astensor([1, 0.5])
>>> normals = pyhf.probability.Normal(means, stds)
>>> normals.expected_data()
array([5., 8.])
Returns

The mean of the Normal distribution (which is the loc)

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