lir.bounding module
- class lir.bounding.LLRBounder(lower_llr_bound: float | None = None, upper_llr_bound: float | None = None)[source]
Bases:
Transformer,ABCBase class for LLR bounders.
A bounder updates any LLRs that are out of bounds. Any LLR values within bounds remain unchanged. LLR values that are out-of-bounds are updated to the nearest bound.
- Parameters:
- apply(instances: InstanceData) LLRData[source]
Recalculate the LLR data using the first step calibrator and applying the bounds.
- Parameters:
instances (InstanceData) – The data to apply the bounder to. This should include the LLRs and their corresponding labels.
- Returns:
The LLR data with the LLRs bounded according to the calculated bounds.
- Return type:
- abstractmethod calculate_bounds(llrdata: LLRData) tuple[float | None, float | None][source]
Calculate and return appropriate bounds for a set of LLRs and their labels.
- Parameters:
llrdata (LLRData) – The LLR data for which to calculate the bounds. This includes the LLRs, their labels, and any other relevant information.
- fit(instances: InstanceData) Self[source]
Configure this bounder by calculating bounds.
assuming that y=1 corresponds to Hp, y=0 to Hd
- Parameters:
instances (InstanceData) – The data to fit the bounder on. This should include the LLRs and their corresponding labels.
- Returns:
The fitted bounder instance.
- Return type:
Self
- class lir.bounding.NSourceBounder(lower_llr_bound: float | None = None, upper_llr_bound: float | None = None)[source]
Bases:
LLRBounderBound LLRs based on the number of sources.
This bounder sets the lower LLR bound to -log(N) and the upper bound to log(N), where N is the number of sources.
In non-log space, this corresponds to bounding likelihood ratios to [1/N, N]. This is a logical consequence of having N sources: no source can provide more than N support for one hypothesis over the other.
- class lir.bounding.StaticBounder(lower_llr_bound: float | None, upper_llr_bound: float | None)[source]
Bases:
LLRBounderBound LLRs to constant values.
This bounder takes arguments for a lower and upper bound, which may take None in which case no bounds are applied.
- Parameters: