kaira.models.binary.soft_bit_thresholding.SoftBitEnsembleThresholder

Inheritance diagram for SoftBitEnsembleThresholder
- class kaira.models.binary.soft_bit_thresholding.SoftBitEnsembleThresholder(thresholders: List[SoftBitThresholder], voting: str = 'majority', weights: Tensor | List[float] | None = None, *args: Any, **kwargs: Any)[source]
Bases:
SoftBitThresholderEnsemble thresholder that combines decisions from multiple thresholders.
This thresholder aggregates the outputs of multiple thresholding approaches using various voting schemes to produce a more robust decision. This can be particularly effective in challenging noise conditions or when the optimal thresholding strategy is unclear.
Example
With thresholders=[FixedThresholder(), AdaptiveThresholder()] and voting=’majority’: The output will be 1.0 only if both thresholders output 1.0.
Methods
Initialize the ensemble thresholder.
Apply ensemble thresholding to convert soft bit values to hard decisions.
Move the model to the specified device.
- __init__(thresholders: List[SoftBitThresholder], voting: str = 'majority', weights: Tensor | List[float] | None = None, *args: Any, **kwargs: Any)[source]
Initialize the ensemble thresholder.
- Parameters:
thresholders – List of thresholders to combine.
voting – Voting strategy to use: ‘majority’, ‘weighted’, ‘any’, or ‘all’.
weights – Optional weights for each thresholder (used with ‘weighted’ voting).
*args – Variable positional arguments passed to the base class.
**kwargs – Variable keyword arguments passed to the base class.
- forward(x: Tensor, *args: Any, **kwargs: Any) Tensor[source]
Apply ensemble thresholding to convert soft bit values to hard decisions.
- Parameters:
x – Input tensor of soft bit values.
*args – Additional positional arguments passed to thresholders.
**kwargs – Additional keyword arguments passed to thresholders.
- Returns:
Tensor of hard bit decisions (0.0 or 1.0).
- to(device: str | device, *args, **kwargs) SoftBitThresholder
Move the model to the specified device.
- Parameters:
device – The device to move the model to.
*args – Additional positional arguments for nn.Module.to().
**kwargs – Additional keyword arguments for nn.Module.to().
- Returns:
Self for method chaining.