pyuncertainnumber.pba.core

Classes

Joint

Helper class that provides a standard way to create an ABC using

Functions

wasserstein_1d(→ float)

An intuitive of Wasserstein metric in 1D, aka. area between two quantile functions

area_metric_ecdf(q1, q2, p)

Wasserstein metric in 1D, aka. area between two quantile functions

endpoint_distance(A, B)

Smallest endpoint distance elementwise between intervals.

area_metric_hint()

distance_to_ecdf_bound(x0, quantile)

Min horizontal distance from x0 to the ECDF defined by quantile.

closer_bound(x0, left_edge, right_edge)

Decide which ECDF bound is closer to x0.

if_outside(x0, left_edge, right_edge)

Check if x0 is outside the ECDF defined by left_edge and right_edge.

if_right_in(x0, left_edge, right_edge)

Check if x0 is inside the ECDF defined by left_edge and right_edge.

directional(x0, left_edge, right_edge)

give instructions on which direction to move the Pbox towards the scalar

calibration_distance(→ float)

Estimate the calibration distance to compensate area metric between a P-box aand a scalar

slide_pbox_towards_scalar(a, b)

Slide the Pbox a towards the scalar b by one step.

Module Contents

class pyuncertainnumber.pba.core.Joint(copula, marginals: list)

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

copula
marginals
pyuncertainnumber.pba.core.wasserstein_1d(q1: numpy.typing.ArrayLike, q2: numpy.typing.ArrayLike, p: numpy.typing.ArrayLike) float

An intuitive of Wasserstein metric in 1D, aka. area between two quantile functions

This is equivaluent to the Area Metric in 1D, which shall return same results as “scipy.stats.wasserstein_distance”

Parameters:
  • q1 (ArrayLike) – quantile vectors (same length, corresponding to probabilities p)

  • q2 (ArrayLike) – quantile vectors (same length, corresponding to probabilities p)

  • p (ArrayLike) – probability vector (between 0 and 1, monotone increasing)

pyuncertainnumber.pba.core.area_metric_ecdf(q1, q2, p)

Wasserstein metric in 1D, aka. area between two quantile functions

This is equivaluent to the Area Metric in 1D.

Parameters:
  • q1 (ArrayLike) – quantile vectors (same length, corresponding to probabilities p)

  • q2 (ArrayLike) – quantile vectors (same length, corresponding to probabilities p)

  • p (ArrayLike) – probability vector (between 0 and 1, monotone increasing). Must be the same for q1 and q2

pyuncertainnumber.pba.core.endpoint_distance(A, B)

Smallest endpoint distance elementwise between intervals.

pyuncertainnumber.pba.core.area_metric_hint()
pyuncertainnumber.pba.core.distance_to_ecdf_bound(x0, quantile)

Min horizontal distance from x0 to the ECDF defined by quantile.

pyuncertainnumber.pba.core.closer_bound(x0, left_edge, right_edge)

Decide which ECDF bound is closer to x0.

Parameters:
  • x0 – a scalar point

  • left_edge – samples from the left bound of the ECDF

  • x_right_samples – samples from the right bound of the ECDF

pyuncertainnumber.pba.core.if_outside(x0, left_edge, right_edge)

Check if x0 is outside the ECDF defined by left_edge and right_edge.

pyuncertainnumber.pba.core.if_right_in(x0, left_edge, right_edge)

Check if x0 is inside the ECDF defined by left_edge and right_edge.

pyuncertainnumber.pba.core.directional(x0, left_edge, right_edge)

give instructions on which direction to move the Pbox towards the scalar

Returns:

output a message variable

pyuncertainnumber.pba.core.calibration_distance(a: pyuncertainnumber.pba.pbox_abc.Pbox, b: numbers.Number) float

Estimate the calibration distance to compensate area metric between a P-box aand a scalar

pyuncertainnumber.pba.core.slide_pbox_towards_scalar(a, b)

Slide the Pbox a towards the scalar b by one step.

Parameters:
  • a – a Pbox

  • b – a scalar

Returns:

a new Pbox that is slid towards b by one step