liana.multi.nmf¶
- liana.multi.nmf(adata: AnnData | None = None, df: DataFrame | None = None, n_components: int | None = None, k_range: range = range(1, 11), use_raw: bool = False, layer: str | None = None, inplace: bool = True, verbose: bool = False, **kwargs)¶
Fits NMF to an AnnData object.
- Parameters:
- adata
Annotated data object.
- n_componentsint, None
Number of components to use. If None, the number of components is estimated using the elbow method.
- k_rangerange
Range of components to test. Default: range(1, 10).
- use_raw
Use raw attribute of adata if present.
- layer
Layer in anndata.AnnData.layers to use. If None, use anndata.AnnData.X.
- inplace
Whether to store results in place, or else to return them.
- **kwargsdict
Keyword arguments to pass to
sklearn.decomposition.NMF
.
- Returns:
- If inplace is True, it will add
NMF_W
andNMF_H
to theadata.obsm
andadata.varm
. - If n_components is None, it will also add
nfm_errors
andnfm_rank
toadata.uns
. - If inplace is False, it will return
W
andH
, and if n_components is None, it will also returnerrors
andn_components
. - If n_components is None and inplace,
errors
andn_components
will be assigned toadata.uns
. - If
df
is provided, inplace is always False.
- If inplace is True, it will add