eb
compression_safeguards.safeguards.pointwise.eb
Error bound safeguard.
Classes:
-
ErrorBoundSafeguard–The
ErrorBoundSafeguardguarantees that the pointwise errortypeis less than or equal to the provided boundeb.
ErrorBoundSafeguard
ErrorBoundSafeguard(
type: str | ErrorBound,
eb: int | float | str | Parameter,
*,
equal_nan: bool = False,
)
Bases: PointwiseSafeguard
The ErrorBoundSafeguard guarantees that the pointwise error type is less than or equal to the provided bound eb.
Infinite values are preserved with the same bit pattern. If equal_nan is
set to True, correcting a NaN value to a NaN value with a
different bit pattern also satisfies the error bound. If equal_nan is set
to False, NaN values are also preserved with the same bit
pattern.
The error bound can be verified by casting the data and error bound to a
sufficiently large floating-point type, selected by
ToFloatMode.lossless.floating_point_dtype_for,
using to_float.
| Parameters: |
|
|---|
| Raises: |
|
|---|
Methods:
-
check_pointwise–Check which elements in the
approximationarray satisfy the error bound. -
compute_safe_intervals–Compute the intervals in which the error bound is upheld with respect
-
compute_footprint–Compute the footprint of the
footarray, e.g. for expanding data -
compute_inverse_footprint–Compute the inverse footprint of the
footarray, e.g. for expanding -
get_config–Returns the configuration of the safeguard.
late_bound
property
The set of late-bound parameters that this safeguard has.
Late-bound parameters are only bound when checking and applying the safeguard, in contrast to the normal early-bound parameters that are configured during safeguard initialisation.
Late-bound parameters can be used for parameters that depend on the specific data that is to be safeguarded.
check_pointwise
check_pointwise(
data: ndarray[S, dtype[T]],
approximation: ndarray[S, dtype[T]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> ndarray[S, dtype[bool]]
Check which elements in the approximation array satisfy the error bound.
| Parameters: |
|
|---|
| Returns: |
|---|
| Raises: |
|
|---|
compute_safe_intervals
compute_safe_intervals(
data: ndarray[S, dtype[T]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> IntervalUnion[T, int, int]
Compute the intervals in which the error bound is upheld with respect
to the data.
| Parameters: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
compute_footprint
compute_footprint(
foot: ndarray[S, dtype[bool]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> ndarray[S, dtype[bool]]
Compute the footprint of the foot array, e.g. for expanding data
points into the pointwise checks that they contribute to.
The footprint is equivalent to foot & where.
| Parameters: |
|
|---|
| Returns: |
|---|
compute_inverse_footprint
compute_inverse_footprint(
foot: ndarray[S, dtype[bool]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> ndarray[S, dtype[bool]]
Compute the inverse footprint of the foot array, e.g. for expanding
pointwise check fails into the points that could have contributed to
the failures.
The inverse footprint is equivalent to foot & where.
| Parameters: |
|
|---|
| Returns: |
|---|