vopy.confidence_region
- class vopy.confidence_region.ConfidenceRegion
Abstract base class for confidence regions.
Confidence Region Types
RectangularConfidenceRegion
- class vopy.confidence_region.RectangularConfidenceRegion(dim: int, lower: numpy.ndarray | None = None, upper: numpy.ndarray | None = None, intersect_iteratively: bool = False)
Implements the axis-aligned hyperrectangular confidence region object.
- Parameters:
dim (int) – The dimension of the hyperrectangle.
lower (Optional[np.ndarray]) – An array representing the lower bounds (lower-most corner) of the hyperrectangle.
upper (Optional[np.ndarray]) – An array representing the upper bounds (upper-most corner) of the hyperrectangle.
intersect_iteratively (bool) – If True, the confidence region is updated by intersecting each incoming hyperrectangle with the current one.
- property center: numpy.ndarray
Returns the center of the hyperrectangle.
- Returns:
Center of the hyperrectangle.
- Return type:
np.ndarray
- classmethod check_dominates(order: PolyhedralConeOrder, obj1: ConfidenceRegion, obj2: ConfidenceRegion, slackness: numpy.ndarray = numpy.array) bool
- Parameters:
order (Order) – Ordering object.
obj1 (ConfidenceRegion) – First hyperrectangle.
obj2 (ConfidenceRegion) – Second hyperrectangle.
slackness (np.ndarray) – Slackness parameter. Not used, but kept for compatibility.
- Returns:
True if all corners of the first hyperrectangle are dominated by corresponding points in the second hyperrectangle, False otherwise.
- Return type:
bool
- diagonal() float
Returns the euclidean norm of the diagonal of the hyperrectangle.
- Returns:
Norm of the diagonal.
- Return type:
float
- intersect(lower: numpy.ndarray, upper: numpy.ndarray) None
Intersect the hyperrectangle with a new hyperrectangle. If there is no intersection, then the new hyperrectangle is used.
- Parameters:
lower (np.ndarray) – Bottom-left corner of the new hyperrectangle.
upper (np.ndarray) – Upper-right corner of the new hyperrectangle.
- classmethod is_covered(order: PolyhedralConeOrder, obj1: ConfidenceRegion, obj2: ConfidenceRegion, slackness: numpy.ndarray) bool
- Parameters:
order (Order) – Ordering object.
obj1 (ConfidenceRegion) – First hyperrectangle.
obj2 (ConfidenceRegion) – Second hyperrectangle.
slackness (np.ndarray) – Slackness parameter. Gives a bonus to the second hyperrectangle.
- Returns:
True if the first hyperrectangle can be covered by the second hyperrectangle, False otherwise.
- Return type:
bool
- classmethod is_dominated(order: PolyhedralConeOrder, obj1: ConfidenceRegion, obj2: ConfidenceRegion, slackness: numpy.ndarray) bool
- Parameters:
order (Order) – Ordering object.
obj1 (ConfidenceRegion) – First hyperrectangle.
obj2 (ConfidenceRegion) – Second hyperrectangle.
slackness (np.ndarray) – Slackness parameter. Gives a bonus to the second hyperrectangle.
- Returns:
True if the first hyperrectangle is dominated by the second one, False otherwise.
- Return type:
bool
- update(mean: numpy.ndarray, covariance: numpy.ndarray, scale: numpy.ndarray = numpy.array) None
Updates the hyperrectangle using a new mean and covariance matrix. Intersects the new hyperrectangle with the current one if intersect_iteratively is True, otherwise uses the new one.
- Parameters:
mean (np.ndarray) – Mean for the new hyperrectangle.
covariance (np.ndarray) – Covariance matrix for the new hyperrectangle.
scale (np.ndarray) – Scaling factor for the covariance matrix.
EllipsoidalConfidenceRegion
- class vopy.confidence_region.EllipsoidalConfidenceRegion(dim: int, center: numpy.ndarray | None = None, sigma: numpy.ndarray | None = None, alpha: float | None = None)
Implements the ellipsoidal confidence region object.
- Parameters:
dim (int) – The dimension of the ellipsoid.
center (Optional[np.ndarray]) – The center of the ellipsoid.
sigma (Optional[np.ndarray]) – The covariance matrix of the ellipsoid.
alpha (Optional[float]) – The scaling factor of the ellipsoid.
- classmethod check_dominates(order: PolyhedralConeOrder, obj1: ConfidenceRegion, obj2: ConfidenceRegion, slackness: numpy.ndarray = numpy.array) bool
Would check if first ellipsoids worst case w.r.t. the order dominates the second ellipsoids worst case w.r.t. the order. Currently not implemented.
- Parameters:
order (Order) – Ordering object.
obj1 (ConfidenceRegion) – First ellipsoid.
obj2 (ConfidenceRegion) – Second ellipsoid.
slackness (np.ndarray) – Slackness parameter. Not used, but kept for compatibility.
- Returns:
True if first ellipsoid dominates the second ellipsoid at their worst points, False otherwise.
- Return type:
bool
- classmethod is_covered(order: PolyhedralConeOrder, obj1: ConfidenceRegion, obj2: ConfidenceRegion, slackness: numpy.ndarray)
- Parameters:
order (Order) – Ordering object.
obj1 (ConfidenceRegion) – First ellipsoid.
obj2 (ConfidenceRegion) – Second ellipsoid.
slackness (np.ndarray) – Slackness parameter. Gives a bonus to the second ellipsoid.
- Returns:
True if the first ellipsoid can be covered by the second ellipsoid, False otherwise.
- Return type:
bool
- classmethod is_dominated(order: PolyhedralConeOrder, obj1: ConfidenceRegion, obj2: ConfidenceRegion, slackness: numpy.ndarray) bool
- Parameters:
order (Order) – Ordering object.
obj1 (ConfidenceRegion) – First ellipsoid.
obj2 (ConfidenceRegion) – Second ellipsoid.
slackness (np.ndarray) – Slackness parameter. Gives a bonus to the second ellipsoid.
- Returns:
True if the first ellipsoid is dominated by the second one, False otherwise.
- Return type:
bool
- update(mean: numpy.ndarray, covariance: numpy.ndarray, scale: numpy.ndarray = numpy.array) None
Updates the ellipsoid using a new mean and covariance matrix.
- Parameters:
mean (np.ndarray) – Center for the new ellipsoid.
covariance (np.ndarray) – Covariance matrix for the new ellipsoid.
scale (np.ndarray) – Scaling factor for the new ellipsoid.
Utilities for confidence regions
- vopy.confidence_region.confidence_region_is_dominated(order: PolyhedralConeOrder, region1: ConfidenceRegion, region2: ConfidenceRegion, slackness: numpy.ndarray) bool
Helper function to call the is_dominated method of the appropriate confidence region object. Checks if the second confidence region dominates the first one at each possible pair of points.
- Parameters:
order (Order) – Ordering object.
obj1 (ConfidenceRegion) – First confidence region.
obj2 (ConfidenceRegion) – Second confidence region.
slackness (np.ndarray) – Slackness parameter. Gives a bonus to the second confidence region.
- Returns:
True if the first confidence region is dominated by the second one, False otherwise.
- Return type:
bool
- vopy.confidence_region.confidence_region_check_dominates(order: PolyhedralConeOrder, region1: ConfidenceRegion, region2: ConfidenceRegion) bool
Helper function to call the check_dominates method of the appropriate confidence region object. Checks if all corners of the first confidence region has a corresponding point in the second confidence region dominated by it. Used for pessimistic comparison.
- Parameters:
order (Order) – Ordering object.
obj1 (ConfidenceRegion) – First confidence region.
obj2 (ConfidenceRegion) – Second confidence region.
slackness (np.ndarray) – Slackness parameter. Not used, but kept for compatibility.
- Returns:
True if all corners of the first confidence region are dominated by corresponding points in the second confidence region, False otherwise.
- Return type:
bool
- vopy.confidence_region.confidence_region_is_covered(order: PolyhedralConeOrder, region1: ConfidenceRegion, region2: ConfidenceRegion, slackness: numpy.ndarray) bool
Helper function to call the is_covered method of the appropriate confidence region object. Checks if there is at least one point in the second confidence region that dominates at least one point from the first confidence region.
- Parameters:
order (Order) – Ordering object.
obj1 (ConfidenceRegion) – First confidence region.
obj2 (ConfidenceRegion) – Second confidence region.
slackness (np.ndarray) – Slackness parameter. Gives a bonus to the second confidence region.
- Returns:
True if the first confidence region can be covered by the second confidence region, False otherwise.
- Return type:
bool