NeuralTSNE.TSNE.Helpers package

Submodules

NeuralTSNE.TSNE.Helpers.helpers module

Hbeta(D: Tensor, beta: float) Tuple[Tensor, Tensor][source]View on GitHub

Calculates entropy and probability distribution based on a distance matrix.

Parameters:
  • D (torch.Tensor) – Distance matrix.

  • beta (float) – Parameter for the computation.

Returns:

Entropy and probability distribution.

Return type:

Tuple[torch.Tensor, torch.Tensor]

Note

The function calculates the entropy and probability distribution based on the provided distance matrix (D) and the specified parameter (beta).

x2p(X: Tensor, perplexity: int, tolerance: float) Tensor[source]View on GitHub

Compute conditional probabilities.

Parameters:
  • X (torch.Tensor) – Input data tensor.

  • perplexity (int) – Perplexity parameter for t-SNE.

  • tolerance (float) – Tolerance level for convergence.

Returns:

Conditional probability matrix.

Return type:

torch.Tensor

x2p_job(data: Tuple[int, Tensor, Tensor], tolerance: float, max_iterations: int = 50) Tuple[int, Tensor, Tensor, int][source]View on GitHub

Performs a binary search to find an appropriate value of beta for a given point.

Parameters:
  • data (Tuple[int, torch.Tensor, torch.Tensor]) – Tuple containing index, distance matrix, and target entropy.

  • tolerance (float) – Tolerance level for convergence.

  • max_iterations (int, optional) – Maximum number of iterations for the binary search. Defaults to 50.

Returns:

Index, probability distribution, entropy difference, and number of iterations.

Return type:

Tuple[int, torch.Tensor, torch.Tensor, int]

Note

The function performs a binary search to find an appropriate value of beta for a given point, aiming to match the target entropy.

Module contents