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_masks so predict() can tile inputs and aggregate per-mask outputs as a Sample.

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: