lir.algorithms.invariance_bounds module
Extrapolation bounds on LRs using the Invariance Verification method by Alberink et al. (2025).
References
Alberink, I., Leegwater, J., Malmborg, J., Nordgaard, A., Sjerps, M., & van der Ham, L. (2025). A transparent method to determine limit values for likelihood ratio systems. Submitted for publication.
- class lir.algorithms.invariance_bounds.IVBounder(lower_llr_bound: float | None = None, upper_llr_bound: float | None = None)[source]
Bases:
LLRBounderCalculate Invariance Verification bounds for a given LR system.
Class that, given an LR system, outputs the same LRs as the system but bounded by the Invariance Verification bounds as described in: A transparent method to determine limit values for Likelihood Ratio systems, by Ivo Alberink, Jeannette Leegwater, Jonas Malmborg, Anders Nordgaard, Marjan Sjerps, Leen van der Ham In: Submitted for publication in 2025.
- lir.algorithms.invariance_bounds.calculate_invariance_bounds(llrdata: LLRData, llr_threshold: ndarray | None = None, step_size: float = 0.001, substitute_extremes: tuple[float, float] = (-20, 20)) tuple[float, float, ndarray, ndarray][source]
Return the upper and lower Invariance Verification bounds of the LRs.
- Parameters:
llrdata (LLRData) – LLR data containing LLRs and ground-truth labels.
llr_threshold (np.ndarray | None, optional) – Predefined LLR thresholds as candidate bounds.
step_size (float, optional) – Required accuracy on a base-10 logarithmic scale.
substitute_extremes (tuple[float, float], optional) – Substitute values for extreme LLRs; smaller and larger LLRs are clipped.
- Returns:
Lower bound, upper bound, lower delta function values, and upper delta function values.
- Return type:
tuple[float, float, np.ndarray, np.ndarray]
- lir.algorithms.invariance_bounds.calculate_invariance_delta_functions(llrdata: LLRData, llr_threshold: ndarray) tuple[ndarray, ndarray][source]
Calculate Invariance Verification delta functions for LRs at given thresholds.
- Parameters:
llrdata (LLRData) – LLR data containing LLRs and ground-truth labels.
llr_threshold (np.ndarray) – Threshold LLR values.
- Returns:
Lower and upper delta values evaluated for all thresholds.
- Return type:
tuple[np.ndarray, np.ndarray]
- lir.algorithms.invariance_bounds.plot_invariance_delta_functions(llrdata: LLRData, llr_threshold_range: tuple[float, float] | None = None, step_size: float = 0.001, ax: Axes | None = None) None[source]
Plot Invariance Verification delta functions and LR bounds.
- Parameters:
llrdata (LLRData) – LLR data containing LLRs and ground-truth labels.
llr_threshold_range (tuple[float, float] | None, optional) – Lower and upper limits for LLR thresholds to include in the figure.
step_size (float, optional) – Required accuracy on a base-10 logarithmic scale.
ax (plt.Axes | None, optional) – Matplotlib axes to plot into.