GaussianAffinity

class torchdr.GaussianAffinity(sigma: float = 1.0, metric: str = 'sqeuclidean', zero_diag: bool = True, device: str = 'auto', keops: bool = False, 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.

  • keops (bool, optional) – Whether to use KeOps for computations.

  • verbose (bool, optional) – Verbosity.