c2v.tl.clone2vec_Poi

Contents

c2v.tl.clone2vec_Poi#

c2v.tl.clone2vec_Poi(clones, z_dim=10, obsp_key='gex_adjacency', mask_key=None, max_iter=500, tol=0.0001, learning_rate=0.5, device=None, progress_bar=True, obsm_key='clone2vec_Poi', uns_key='clone2vec_Poi', random_state=4, col_size_factor=True, row_intercept=True, num_ccd_iter=3, adaptive_lr=True, slowing_loglik=True, lr_decay=0.5, min_learning_rate=1e-05, max_backtracks=3, batch_size_rows=None, batch_size_cols=None, init='svd')#

Learn a clonal embedding using fastglmpca [PMID: 39110511] Python implementation and store the embeddings. When col_size_factor is True and row_intercept is True, the results should be comparable with the regular clone2vec.

Parameters:
clones AnnData

The clone-level AnnData object, typically from create_clone_adata.

z_dim int, optional

Dimensionality of the clonal embedding, by default 10.

obsp_key str, optional

Key in clones.obsp for the graph to use, by default “gex_adjacency”.

max_iter int, optional

Maximum number of iterations for optimization, by default 500.

tol float, optional

Tolerance for convergence, by default 1e-4.

learning_rate float | None, optional

Learning rate for optimization, by default 0.5.

device str | None, optional

Device to use for computation, by default None.

progress_bar bool, optional

Whether to show a progress bar, by default True.

obsm_key str, optional

Key in clones.obsm to store the embeddings, by default “clone2vec_Poi”.

uns_key str, optional

Key in clones.uns to store the model parameters, by default “clone2vec_Poi”.

random_state None | int, optional

Random state for reproducibility, by default 4.

col_size_factor bool, optional

Whether to use column size factors, by default True.

row_intercept bool, optional

Whether to use row intercepts, by default True.

num_ccd_iter int, optional

Number of CCD iterations, by default 3.

adaptive_lr bool, optional

If True, reduce learning rate on log-likelihood drops. Default is True.

slowing_loglik bool, optional

If True, adaptively reduce learning rate when log-likelihood changing rate increases. Default is True.

lr_decay float, optional

Multiplicative decay factor applied when log-likelihood decreases. Default is 0.5.

min_learning_rate float, optional

Minimum allowed learning rate during adaptation. Default is 1e-5.

max_backtracks int, optional

Maximum number of backtracking retries per iteration when log-likelihood decreases. Default is 3.

batch_size_rows int | None, optional

Batch size for rows, by default None.

batch_size_cols int | None, optional

Batch size for columns, by default None.

init str, optional

Initialization method, by default “svd”.

mask_key str | None

Return type:

None | Module

Returns:

None | torch.nn.Module If return_model is True, returns the trained model.