tdhook.latent.dimension_estimation._utils#

Shared utilities for intrinsic dimension estimation.

Functions#

sorted_neighbors(data, eps)

Compute sorted distances and indices of neighbors for each point.

Module Contents#

tdhook.latent.dimension_estimation._utils.sorted_neighbors(data, eps)[source]#

Compute sorted distances and indices of neighbors for each point.

Returns (sorted_dist, indices) each of shape (N, N). Each row is sorted ascending. Self and distances <= eps are inf, with their indices appearing last in each row.

Parameters:
  • data (torch.Tensor)

  • eps (float)

Return type:

tuple[torch.Tensor, torch.Tensor]