PHATE#

class torchdr.PHATE(k: int = 5, n_components: int = 2, t: int = 100, alpha: float = 10.0, optimizer: str = 'Adam', optimizer_kwargs: dict = {}, lr: float = 1.0, scheduler: str | None = None, scheduler_kwargs: dict = {}, min_grad_norm: float = 1e-15, max_iter: int = 1000, init: str = 'pca', init_scaling: float = 0.0001, device: str = 'auto', backend: str | None = None, verbose: bool = False, random_state: float | None = None, check_interval: int = 50, metric_in: str = 'euclidean')[source]#

Bases: AffinityMatcher

Implementation of PHATE introduced in [Moon et al., 2019].

PHATE is a diffusion map-based method that uses a potential affinity matrix \(\mathbf{P}\) implemented in PHATEAffinity as input.

The loss function is defined as:

\[\sqrt{\sum_{i,j} (P_{ij} - \|\mathbf{z}_i - \mathbf{z}_j\|)^2 / \sum_{i,j} P_{ij}^2} \:.\]
Parameters:
  • k (int, optional) – Number of nearest neighbors. Default is 5.

  • n_components (int, optional) – Dimension of the embedding space. Default is 2.

  • t (int, optional) – Diffusion time parameter. Default is 100.

  • alpha (float, optional) – Exponent for the alpha-decay kernel. Default is 10.0.

  • optimizer (str or torch.optim.Optimizer, optional) – Name of an optimizer from torch.optim or an optimizer class. Default is “Adam”.

  • optimizer_kwargs (dict, optional) – Additional keyword arguments for the optimizer.

  • lr (float or 'auto', optional) – Learning rate for the optimizer. Default is 1e0.

  • scheduler (str or torch.optim.lr_scheduler.LRScheduler, optional) – Name of a scheduler from torch.optim.lr_scheduler or a scheduler class. Default is None (no scheduler).

  • scheduler_kwargs (dict, optional) – Additional keyword arguments for the scheduler.

  • min_grad_norm (float, optional) – Tolerance for stopping criterion. Default is 1e-15.

  • max_iter (int, optional) – Maximum number of iterations. Default is 1000.

  • init (str, torch.Tensor, or np.ndarray, optional) – Initialization method for the embedding. Default is “pca”.

  • init_scaling (float, optional) – Scaling factor for the initial embedding. Default is 1e-4.

  • device (str, optional) – Device to use for computations. Default is “auto”.

  • backend ({"None}, optional) – Which backend to use for handling sparsity and memory efficiency. Default is None.

  • verbose (bool, optional) – Verbosity of the optimization process. Default is False.

  • random_state (float, optional) – Random seed for reproducibility. Default is None.

  • check_interval (int, optional) – Number of iterations between two checks for convergence. Default is 50.