ehrapy.preprocessing.power_norm¶
- ehrapy.preprocessing.power_norm(adata, vars=None, group_key=None, copy=False, **kwargs)[source]¶
Apply power transformation normalization.
Functionality is provided by
PowerTransformer()
, see https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.PowerTransformer.html for details.- Parameters:
adata (
AnnData
) –AnnData
object containing X to normalize values in. Must already be encoded usingencode()
.vars (
str
|Sequence
[str
] |None
, default:None
) – List of the names of the numeric variables to normalize. If None all numeric variables will be normalized.group_key (
str
|None
, default:None
) – Key in adata.obs that contains group information. If provided, scaling is applied per group.copy (
bool
, default:False
) – Whether to return a copy or act in place.**kwargs – Additional arguments passed to the PowerTransformer.
- Return type:
- Returns:
None if copy=False and modifies the passed adata, else returns an updated AnnData object. Also stores a record of applied normalizations as a dictionary in adata.uns[“normalization”].
Examples
>>> import ehrapy as ep >>> adata = ep.dt.mimic_2(encoded=True) >>> adata_norm = ep.pp.power_norm(adata, copy=True)