pyhgf.math.gaussian_surprise#
- pyhgf.math.gaussian_surprise(x, expected_mean, expected_precision)[source]#
Surprise at an outcome under a Gaussian prediction.
The surprise elicited by an observation \(x\) under a Gaussian distribution with expected mean \(\hat{\mu}\) and expected precision \(\hat{\pi}\) is given by:
\[\frac{1}{2} (\log(2 \pi) - \log(\hat{\pi}) + \hat{\pi}(x - \hat{\mu})^2)\]where \(\pi\) is the mathematical constant.
- Parameters:
x (float | Array | ndarray | bool | number | bool | int | complex) – The outcome.
expected_mean (float | Array | ndarray | bool | number | bool | int | complex) – The expected mean of the Gaussian distribution.
expected_precision (float | Array | ndarray | bool | number | bool | int | complex) – The expected precision of the Gaussian distribution.
- Returns:
The Gaussian surprise.
- Return type:
surprise
Examples
>>> from pyhgf.math import gaussian_surprise >>> gaussian_surprise(x=2.0, expected_mean=0.0, expected_precision=1.0) `Array(2.9189386, dtype=float32, weak_type=True)`