mlcolvar.core.loss.AutocorrelationLoss¶
- class mlcolvar.core.loss.AutocorrelationLoss(reduce_mode: str = 'sum2', invert_sign: bool = True)[source]¶
Bases:
Module(Weighted) autocorrelation loss.
Computes the sum (or another reducing functions) of the eigenvalues of the autocorrelation matrix. This is the same loss function used in
DeepTICA.- __init__(reduce_mode: str = 'sum2', invert_sign: bool = True)[source]¶
Constructor.
- Parameters:
reduce_mode (str) – This determines how the eigenvalues are reduced, e.g.,
sum,sum2(see alsoReduceEigenvaluesLoss). The default is'sum2'.invert_sign (bool, optional) – Whether to return the negative autocorrelation in order to be minimized with gradient descent methods. Default is
True.
Methods
__init__([reduce_mode, invert_sign])Constructor.
forward(x, x_lag[, weights, weights_lag])Estimate the autocorrelation.
- forward(x: Tensor, x_lag: Tensor, weights: Tensor | None = None, weights_lag: Tensor | None = None) Tensor[source]¶
Estimate the autocorrelation.
- Parameters:
x (torch.Tensor) – Shape
(n_batches, n_features). The features of the sample at timet.x_lag (torch.Tensor) – Shape
(n_batches, n_features). The features of the sample at timet + lag.weights (torch.Tensor, optional) – Shape
(n_batches,)or(n_batches, 1). The weights associated toxat timet. Default isNone.weights_lag (torch.Tensor, optional) – Shape
(n_batches,)or(n_batches, 1). The weights associated toxat timet + lag. Default isNone.
- Returns:
loss – Loss value.
- Return type:
torch.Tensor
Attributes
T_destination
call_super_init
dump_patches
training