pygot.tools.traj.fit_velocity_model#
- pygot.tools.traj.fit_velocity_model(adata, time_key, embedding_key, landmarks=False, device=None, graph_key=None, n_neighbors=50, v_centric_iter_n=1000, v_centric_batch_size=256, add_noise=True, sigma=0.1, lr=0.005, path='', linear=False, distance_metrics='SP', pretrained_model=None, x_centric=True, x_centric_iter_n=2000, x_centric_batch_size=256, reverse_schema=True, time_varying=True, filtered=True, **kwargs)[source]#
Estimates velocities and fit trajectories in latent space.
Arguments:#
- adata:
AnnData
Annotated data matrix.
- time_key: str
Name of time label in adata.obs
- embedding_key: `str’
Name of latent space to fit, in adata.obsm
- landmarks: bool
Use landmarks to approximate graphical paths
- graph_key: str (default: None)
Name of graph to fit, in adata.obsm
- device:
device
torch device
- n_neighbors: int (default: 50)
Neighbors number in kNN
- v_centric_iter_n: int (default: 1000)
Iteration number of v-centric training
- v_centric_batch_size: int (default: 256)
Batch size of v-centric training. Note: increase will dramatically increase training time due to the complexity of OT
- add_noise: bool (default: True)
Assumption of gaussian distribution of velocity
- sigma: float (default: 0.1)
The variance of gaussian distribution of velocity
- distance_metrics: ‘SP’ or ‘L2’ (default: ‘SP’)
Distance metrics in optimal transport (shortest path distance or euclidean distance)
- pretrained_model: :class`~torch.nn.Module` (default: None)
Training for pretraiened model
- path: str (default: None)
Dir path to store shorest path file
- linear: bool (default: False)
Accept linear path or not
- filtered: bool (default: True)
Use filtered velocity or not
- x_centric: bool (default: True)
Do x-centric training
- x_centric_iter_n: int (default: 2000)
Iteration number of x-centric training
- x_centric_batch_size: int (default: 256)
Batch size of x-centric training
- reverse_schema: bool (default: True)
Simulation trajectory from end to start also (e.g. day7 -> day0), in x-centric training
- time_varying: bool (default: True)
The neural network model use time label as input or not
- lr: float (default: 5e-3)
Learning rate
- returns:
model (:class`~ODEwrapper`) – velocity model
history (list) – training history
- adata: