celldancer.velocity¶
- celldancer.velocity(cell_type_u_s, gene_list=None, max_epoches=200, check_val_every_n_epoch=10, patience=3, learning_rate=0.001, dt=0.5, n_neighbors=30, permutation_ratio=0.125, speed_up=True, norm_u_s=True, norm_cell_distribution=True, loss_func='cosine', n_jobs=- 1, save_path=None)¶
Velocity estimation for each cell.
- Parameters
cell_type_u_s (pandas.DataFrame) – Dataframe that contains the unspliced abundance, spliced abundance, embedding space, and cell type information. Columns=[‘gene_name’, ‘unsplice’, ‘splice’ ,’cellID’ ,’clusters’ ,’embedding1’ ,’embedding2’]
gene_list (optional, list (default: None)) – Gene list for velocity estimation. None if to estimate the velocity of all genes.
max_epoches (optional, int (default: 200)) – Stop to update the network once this number of epochs is reached.
check_val_every_n_epoch (optional, int (default: 10)) – Check loss every n train epochs.
patience (optional, int (default: 3)) – Number of checks with no improvement after which training will be stopped.
dt (optional, float (default: 0.5)) – Step size
permutation_ratio (optional, float (default: 0.125)) – Sampling ratio of cells in each epoch when training each gene.
speed_up (optional, bool (default: True)) – True if speed up by downsampling cells. False if to use all cells to train the model.
norm_u_s (optional, bool (default: True)) – True if normalize unsplice (and splice) reads by dividing max value of unspliced (and spliced) reads.
norm_cell_distribution (optional, bool (default: True)) – True if the bias of cell distribution is to be removed on embedding space (many cells share the same position of unspliced (and spliced) reads).
loss_func (optional, str (default: cosine)) – Currently support ‘cosine’, ‘rmse’, and (‘mix’, mix_ratio).
n_jobs (optional, int (default: -1)) – The maximum number of concurrently running jobs.
save_path (optional, str (default: 200)) – Path to save the result of velocity estimation.
- Returns
loss_df (pandas.DataFrame) – The record of loss.
cellDancer_df (pandas.DataFrame) – The result of velocity estimation.