pyhgf.math.gaussian_surprise#
- pyhgf.math.gaussian_surprise(x: float | Array | ndarray | bool_ | number | bool | int | complex, expected_mean: float | Array | ndarray | bool_ | number | bool | int | complex, expected_precision: float | Array | ndarray | bool_ | number | bool | int | complex) Array [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
The outcome.
- expected_mean
The expected mean of the Gaussian distribution.
- expected_precision
The expected precision of the Gaussian distribution.
- Returns:
- surprise
The Gaussian 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)`