paste3.paste.center_NMF
- paste3.paste.center_NMF(feature_matrix, slices, pis, slice_weights, n_components, random_seed, exp_dissim_metric='kl', device='cpu', fast=False)[source]
Finds two low-rank matrices ( W ) (feature matrix) and ( H ) (coefficient matrix) that approximate expression matrices of all slices by minimizing the following objective function:
\[S(W, H) = \sum_q \lambda_q \sum_{i, j} c((WH)_i, x_j^{(q)}) \pi_{ij}^{(q)}\]- Parameters:
feature_matrix (np.ndarray) -- The matrix representing the features extracted from the slices.
slices (List[AnnData]) -- A list of AnnData objects representing the slices involved in the mapping.
pis (List[torch.Tensor]) -- List of optimal transport plans for each slice, used to weight the features.
slice_weights (List[float]) -- Weights associated with each slice, indicating their importance in the NMF process.
n_components (int) -- The number of components to extract from the NMF.
random_seed (int) -- Random seed for reproducibility.
exp_dissim_metric (str, default="kl") -- The metric used for measuring dissimilarity. Options include "euclidean" and "kl" for Kullback-Leibler divergence.
fast (bool, default=False) -- Whether to use the fast (untested) torch nmf library
- Returns:
A tuple containing: - new_feature_matrix : np.ndarray
The updated matrix of features after applying NMF.
- new_coeff_matrixnp.ndarray
The updated matrix of coefficients resulting from the NMF decomposition.
- Return type:
Tuple[np.ndarray, np.ndarray]