GaussianAffinity#
- class torchdr.GaussianAffinity(sigma: float = 1.0, metric: str = 'sqeuclidean', zero_diag: bool = True, device: str = 'auto', backend: str | None = None, verbose: bool = True)[source]#
Bases:
UnnormalizedLogAffinity
Compute the Gaussian affinity matrix.
Its expression is as follows : \(\exp( - \mathbf{C} / \sigma)\) where \(\mathbf{C}\) is the pairwise distance matrix and \(\sigma\) is the bandwidth parameter.
- Parameters:
sigma (float, optional) – Bandwidth parameter.
metric (str, optional) – Metric to use for pairwise distances computation.
zero_diag (bool, optional) – Whether to set the diagonal of the affinity matrix to zero.
device (str, optional) – Device to use for computations.
backend ({"keops", "faiss", None}, optional) – Which backend to use for handling sparsity and memory efficiency. Default is None.
verbose (bool, optional) – Verbosity.