Affinity

class torchdr.Affinity(metric: str = 'sqeuclidean', zero_diag: bool = True, device: str = 'auto', keops: bool = False, verbose: bool = False)[source]

Bases: ABC

Base class for affinity matrices.

Parameters:
  • metric (str, optional) – The distance metric to use for computing pairwise distances.

  • zero_diag (bool, optional) – Whether to set the diagonal of the affinity matrix to zero.

  • device (str, optional) – The device to use for computation. Typically “cuda” for GPU or “cpu” for CPU. If “auto”, uses the device of the input data.

  • keops (bool, optional) – Whether to use KeOps for efficient computation of large-scale kernel operations.

  • verbose (bool, optional) – If True, prints additional information during computation. Default is False.

Examples using Affinity:

Entropic Affinities can adapt to varying noise levels

Entropic Affinities can adapt to varying noise levels

PCA via SVD and via AffinityMatcher

PCA via SVD and via AffinityMatcher

Neighbor Embedding on genomics & equivalent affinity matcher formulation

Neighbor Embedding on genomics & equivalent affinity matcher formulation