spateo.alignment.methods.deprecated_morpho_sparse_utils¶
Attributes¶
Functions¶
|
|
|
|
|
Get the optimal rotation matrix R |
|
|
|
|
|
|
|
|
|
|
|
|
|
Compute the pairwise cosine similarity between all pairs of samples in matrices X and Y. |
|
|
|
|
|
|
|
Module Contents¶
- spateo.alignment.methods.deprecated_morpho_sparse_utils.calc_distance(X_A: numpy.ndarray | torch.Tensor, X_B: numpy.ndarray | torch.Tensor, metric: str = 'euc', batch_capacity: int = 1, use_sparse: bool = False, sparse_method: str = 'topk', threshold: int | float = 100, return_mask: bool = False, save_to_cpu: bool = False, **kwargs)[source]¶
- spateo.alignment.methods.deprecated_morpho_sparse_utils.get_optimal_R_sparse(coordsA: numpy.ndarray | torch.Tensor, coordsB: numpy.ndarray | torch.Tensor, P: numpy.ndarray | torch.Tensor | torch.sparse_coo_tensor, R_init: numpy.ndarray | torch.Tensor)[source]¶
Get the optimal rotation matrix R
- Parameters:
- coordsA Union[np.ndarray, torch.Tensor]
The first input matrix with shape n x d
- coordsB Union[np.ndarray, torch.Tensor]
The second input matrix with shape n x d
- P Union[np.ndarray, torch.Tensor]
The optimal transport matrix with shape n x n
- Returns:
The optimal rotation matrix R with shape d x d
- Return type:
Union[np.ndarray, torch.Tensor]
- spateo.alignment.methods.deprecated_morpho_sparse_utils._init_guess_sigma2(XA, XB, subsample=2000)[source]¶
- spateo.alignment.methods.deprecated_morpho_sparse_utils._init_guess_beta2(nx, XA, XB, dissimilarity='kl', partial_robust_level=1, beta2=None, beta2_end=None, subsample=2000)[source]¶
- spateo.alignment.methods.deprecated_morpho_sparse_utils._construct_label_mask(nx, labelA, labelB, label_transfer_prior, type_as)[source]¶
- spateo.alignment.methods.deprecated_morpho_sparse_utils._dense_to_sparse(mat: numpy.ndarray | torch.Tensor, sparse_method: str = 'topk', threshold: int | float = 100, axis: int = 0, descending=False)[source]¶
- spateo.alignment.methods.deprecated_morpho_sparse_utils._SparseTensor(nx, row, col, value, sparse_sizes)[source]¶
- spateo.alignment.methods.deprecated_morpho_sparse_utils._cos_similarity(mat1: numpy.ndarray | torch.Tensor, mat2: numpy.ndarray | torch.Tensor)[source]¶
- spateo.alignment.methods.deprecated_morpho_sparse_utils._cosine_distance_backend(X: numpy.ndarray | torch.Tensor, Y: numpy.ndarray | torch.Tensor, eps: float = 1e-08) numpy.ndarray | torch.Tensor [source]¶
Compute the pairwise cosine similarity between all pairs of samples in matrices X and Y.
- Parameters:
- X np.ndarray or torch.Tensor
Matrix with shape (N, D), where each row represents a sample.
- Y np.ndarray or torch.Tensor
Matrix with shape (M, D), where each row represents a sample.
- eps float, optional
A small value to avoid division by zero. Default is 1e-8.
- Returns:
Pairwise cosine similarity matrix with shape (N, M).
- Return type:
np.ndarray or torch.Tensor
- Raises:
AssertionError – If the number of features in X and Y do not match.
- spateo.alignment.methods.deprecated_morpho_sparse_utils._cos_similarity(mat1: numpy.ndarray | torch.Tensor, mat2: numpy.ndarray | torch.Tensor)[source]¶
- spateo.alignment.methods.deprecated_morpho_sparse_utils._dist(mat1: numpy.ndarray | torch.Tensor, mat2: numpy.ndarray | torch.Tensor, metric: str = 'euc') numpy.ndarray | torch.Tensor [source]¶