NormalizedGaussianAffinity

class torchdr.NormalizedGaussianAffinity(sigma: float = 1.0, metric: str = 'sqeuclidean', zero_diag: bool = True, device: str = 'auto', keops: bool = False, verbose: bool = False, normalization_dim: int | Tuple[int] = (0, 1))[source]

Bases: LogAffinity

Compute the Gaussian affinity matrix which can be normalized along a dimension.

The algorithm computes \(\exp( - \mathbf{C} / \sigma)\) where \(\mathbf{C}\) is the pairwise distance matrix and \(\sigma\) is the bandwidth parameter. The affinity can be normalized according to the specified normalization dimension.

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.

  • normalization_dim (int or Tuple[int], optional) – Dimension along which to normalize the affinity matrix. Default is (0, 1)

Examples using NormalizedGaussianAffinity:

Entropic Affinities can adapt to varying noise levels

Entropic Affinities can adapt to varying noise levels

Neighbor Embedding on genomics & equivalent affinity matcher formulation

Neighbor Embedding on genomics & equivalent affinity matcher formulation