axtreme.distributions.helpers

Helpers built ontop of the distributions module.

Todo

These are seperate from utils becuase of circular import caused by ApproximateMixture. Potentially there is a more elegant solution.

Functions

approx_mixture_cdf_resolution(dist)

To what resolution (number of decimal places) is cdf output accurate to.

dist_cdf_resolution(dist)

To what resolution (number of decimal places) is cdf output accurate to.

mixture_cdf_resolution(dist)

To what resolution (number of decimal places) is cdf output accurate to.

axtreme.distributions.helpers.approx_mixture_cdf_resolution(dist: ApproximateMixture) float

To what resolution (number of decimal places) is cdf output accurate to.

This is identical to mixture_cdf_resolution except for the conservatism introduced by the approximation. See ApproximateMixture “Impact of Approximation:” for details

axtreme.distributions.helpers.dist_cdf_resolution(dist: Distribution) float

To what resolution (number of decimal places) is cdf output accurate to.

This is effected by:

  • The numeric precision of the datatype q is stored with (e.g float32)

  • The internal calculation and numerical error incurrred by them.

Returns:

10**precision, where precision is the decimal position. E.g if accurate to 3 decimal places, return 0.001

Note

  • We are interested in the cdf(x) -> q accuracy, as this is used heavily.

  • icdf(q) -> x does not have the same resolution as detailed here. The difference in results increases with x.

  • This number/method is determined emprically. Tests show it is a good bound for float16 and float32.

    Assumed to hold for float64

axtreme.distributions.helpers.mixture_cdf_resolution(dist: MixtureSameFamily) float

To what resolution (number of decimal places) is cdf output accurate to.

This compared to dist_cdf_resolution this is also impacted by weights*components.

This is effected by:

  • The numeric precision of the datatype q is stored with (e.g float32)

  • The internal calculation and numerical error incurred by them.

  • Combination of weight*components

Returns:

10**precision, where precision is the decimal position. E.g if accurate to 3 decimal places, return 0.001

Note

  • We are interested in the cdf(x) -> q accuracy, as this is used heavily.

  • icdf(q) -> x does not have the same resolution as this. The difference in results increases with x.

  • This number/method is determined emprically. Tests show it is a good bound for float16 and float32. Assumed to hold for float64