HieDiff.run_HieDiff_minibatch#

HieDiff.run_HieDiff_minibatch(adata, n_epochs=1000, n_hidden=128, n_latent=10, batch_key=None, covar_key=None, device=None, copy=False)[source]#

The mini-batch implementation for hierarchical flow diffusion.

Parameters:
adata : AnnData

Annotated data matrix.

n_epochs : int (default: 1000)

Number of epochs for training neural network. Default to 1000.

n_hidden : int (default: 128)

Number of neurons in the hidden layer. Default to 128.

n_latent : int (default: 10)

Number of neurons in the latent layer. Default to 10.

params_dict

The pretrained parameters for initialing the neural network. If not specified, the parameters in the neural network is randomly initialized.

batch_key : str | NoneOptional[str] (default: None)

The key to retriving batch information in adata.obs[batch_key]. If not specified, the batch correction is not considered.

covar_key : str | NoneOptional[str] (default: None)

The key to retriving covariates in adata.obsm[covar_key]. If not specified, the covariates is not considered.

device : str | NoneOptional[str] (default: None)

The desired device for PyTorch computation. By default uses cuda if cuda is avaliable cpu otherwise.

copy : bool (default: False)

Return a copy instead of writing to adata.

Return type:

Optional[AnnData]

Returns:

: Depending on copy, returns or updates adata with the following fields.

.obsm[‘qz’]ndarray

The latent representation of gene expression.

.varp[‘W’]csr_matrix

The gene-by-gene relation matrix.

.layers[‘x4’]ndarray

The denoised gene expression matrix.