cellrank.tl.kernels.VelocityKernel.compute_transition_matrix

VelocityKernel.compute_transition_matrix(mode='deterministic', backward_mode='transpose', scheme='correlation', softmax_scale=None, n_samples=1000, seed=None, **kwargs)[source]

Compute transition matrix based on velocity directions on the local manifold.

For each cell, infer transition probabilities based on the cell’s velocity-extrapolated cell state and the cell states of its K nearest neighbors.

Parameters
  • mode (str) –

    How to compute transition probabilities. Valid options are:

    • ’deterministic’ - deterministic computation that doesn’t propagate uncertainty.

    • ’monte_carlo’ - Monte Carlo average of randomly sampled velocity vectors.

    • ’stochastic’ - second order approximation, only available when jax is installed.

    • ’sampling’ - sample 1 transition matrix from the velocity distribution.

  • backward_mode (str) –

    Only matters if initialized as backward =True. Valid options are:

    • ’transpose’ - compute transitions from neighboring cells j to cell i.

    • ’negate’ - negate the velocity vector.

  • softmax_scale (Optional[float]) – Scaling parameter for the softmax. If None, it will be estimated using 1 / median(correlations). The idea behind this is to scale the softmax to counteract everything tending to orthogonality in high dimensions.

  • scheme (Union[str, Callable]) –

    Similarity scheme between cells as described in [Li2020]. Can be one of the following:

    Alternatively, any function can be passed as long as it follows the call signature of cellrank.tl.kernels.SimilaritySchemeABC.

  • n_samples (int) – Number of bootstrap samples when mode='monte_carlo'.

  • seed (Optional[int]) – Set the seed for random state when the method requires n_samples.

  • show_progress_bar – Whether to show a progress bar. Disabling it may slightly improve performance.

  • n_jobs – Number of parallel jobs. If -1, use all available cores. If None or 1, the execution is sequential.

  • backend – Which backend to use for parallelization. See joblib.Parallel for valid options.

Returns

Makes available the following fields:

Return type

cellrank.tl.kernels.VelocityKernel