abc
compression_safeguards.safeguards.pointwise.abc
Abstract base class for the pointwise safeguards.
Classes:
-
PointwiseSafeguard–Pointwise safeguard abstract base class.
PointwiseSafeguard
Pointwise safeguard abstract base class.
Pointwise safeguards describe properties that are satisfied (or not) per element, i.e. independent of other elements.
Methods:
-
check–Check if the
approximationarray upholds the property enforced by this -
check_pointwise–Check which elements in the
approximationarray uphold the property -
compute_safe_intervals–Compute the intervals in which the safeguard's guarantees 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
check
check(
data: ndarray[S, dtype[T]],
approximation: ndarray[S, dtype[T]],
*,
late_bound: Bindings,
where: Literal[True] | ndarray[S, dtype[bool]] = True,
) -> bool
Check if the approximation array upholds the property enforced by this
safeguard.
| Parameters: |
|
|---|
| Returns: |
|
|---|
check_pointwise
abstractmethod
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 uphold the property
enforced by this safeguard.
| Parameters: |
|
|---|
| Returns: |
|---|
compute_safe_intervals
abstractmethod
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 safeguard's guarantees with respect
to the data are upheld.
The returned union of intervals must not have any overlap between the
intervals inside the union. The data must be contained in the union.
| Parameters: |
|
|---|
| Returns: |
|
|---|
compute_footprint
abstractmethod
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.
For pointwise safeguards, the footprint should be equivalent to
foot & where.
| Parameters: |
|
|---|
| Returns: |
|---|
compute_inverse_footprint
abstractmethod
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.
For pointwise safeguards, the inverse footprint should be equivalent to
foot & where.
| Parameters: |
|
|---|
| Returns: |
|---|