masksembles¶
- probly.method.masksembles(base: Predictor[In, Out], num_masks: int = 4, scale: float = 2.0) MasksemblesPredictor[In, Out][source]¶
Create a Masksembles predictor from a base predictor based on [DBBaqueF21].
Appends a binary mask layer after each hidden linear or convolutional layer (the last layer is skipped). The result is tagged with
num_maskssopredict()can tile inputs and aggregate per-mask outputs as aSample.- Parameters:
base – The base model to apply Masksembles to.
num_masks – Number of binary masks to generate.
scale – Controls mask overlap; higher values produce less correlated masks at the cost of capacity per masked sub-network.
- Returns:
The Masksembles predictor wrapping the base model.
- Raises:
ValueError – If
num_masksis not a positive integer.ValueError – If
scaleis not in(0, 6].