probly.method.ddu

probly.method.ddu(base: Predictor[In, Out], sn_coeff: float = 3.0) DDUPredictor[In, Out][source]

Transform a model for Deep Deterministic Uncertainty based on [MKvA+23].

Applies spectral normalization to all Conv2d and Linear layers except the classification head (the last Linear layer), replaces ReLU and ReLU6 activations with LeakyReLU(0.01), and replaces stride-1x1 downsampling convolutions with AvgPool2d followed by a stride-1 Conv2d.

The forward pass is unchanged, preserving full training compatibility.

Parameters:
  • base – Base classification model to be transformed.

  • sn_coeff – Lipschitz coefficient for spectral normalization. Weights whose spectral norm exceeds this value are rescaled down to it. Default is 3.

Returns:

The transformed model.