gedi2py.tools.svd¶
- gedi2py.tools.svd(adata, *, key='gedi', copy=False)[source]¶
Compute factorized SVD from GEDI decomposition.
Computes SVD while preserving GEDI’s factorized structure:
SVD(Z) × SVD(middle) × SVD(DB). This maintains biological interpretability by respecting the decomposition structure.- Parameters:
- Return type:
- Returns:
If ``copy=True``,returns dict with keys ````’d’:py:class:``, :py:class:``’u’:py:class:``, :py:class:``’v’:py:class:`.`Otherwise,stores results in ``adata.uns[key][``’svd’:py:class:`]`andreturns ``None`.`The SVD components are–d: Singular values (K,)u: Left singular vectors (n_genes, K) - gene loadingsv: Right singular vectors (n_cells, K) - cell embeddings
Examples
>>> import gedi2py as gd >>> gd.tl.gedi(adata, batch_key="sample", n_latent=10) >>> gd.tl.svd(adata) >>> adata.uns["gedi"]["svd"]["d"] # singular values