reducers¶

class
torchdrift.reducers.
PCAReducer
(n_components: int = 2)¶ Reduce dimensions using PCA.
This nn.Modue subclass reduces the dimensions of the inputs specified by n_components.
The input is a 2dimensional Tensor of size batch x features, the output is a Tensor of size batch x n_components.

fit
(x: torch.Tensor) → torch.Tensor¶


class
torchdrift.reducers.
Reducer
¶ Base class for reducers.
This is a torch.nn.Module with an additional fit method. The usual forward is for testing after fitting.

fit
(x: torch.Tensor) → torch.Tensor¶ Fits the reducer to reference data x and returns the reduced data.
Override this in your reducer implementation.

forward
(x: torch.Tensor) → torch.Tensor¶ Reduces the input x (in testing) and returns the reduced data.
Override this in your reducer implementation.
