UMAPAffinityIn
- class torchdr.UMAPAffinityIn(n_neighbors: float = 30, tol: float = 1e-05, max_iter: int = 1000, sparsity: bool | str = 'auto', metric: str = 'sqeuclidean', zero_diag: bool = True, device: str = 'auto', keops: bool = False, verbose: bool = False)[source]
Bases:
SparseLogAffinity
Compute the input affinity used in UMAP [M18].
The algorithm computes via root search the variable \(\mathbf{\sigma}^* \in \mathbb{R}^n_{>0}\) such that
\[\forall i, \: \sum_j P_{ij} = \log (\mathrm{n_neighbors}) \quad \text{where} \quad \forall (i,j), \: P_{ij} = \exp(- (C_{ij} - \rho_i) / \sigma^\star_i)\]and \(\rho_i = \min_j C_{ij}\).
- Parameters:
n_neighbors (float, optional) – Number of effective nearest neighbors to consider. Similar to the perplexity.
tol (float, optional) – Precision threshold for the root search.
max_iter (int, optional) – Maximum number of iterations for the root search.
sparsity (bool or 'auto', optional) – Whether to use sparsity mode.
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. Default is False.
References
[M18]Leland McInnes, John Healy, James Melville (2018). UMAP: Uniform manifold approximation and projection for dimension reduction. arXiv preprint arXiv:1802.03426.