dynamo.vf.SvcVectorField

class dynamo.vf.SvcVectorField(X=None, V=None, Grid=None, *args, **kwargs)[source]

Initialize the VectorField class.

Parameters
  • X (ndarray (dimension: n_obs x n_features)) – Original data.

  • V (ndarray (dimension: n_obs x n_features)) – Velocities of cells in the same order and dimension of X.

  • Grid (ndarray) – The function that returns diffusion matrix which can be dependent on the variables (for example, genes)

  • M (int (default: None)) – The number of basis functions to approximate the vector field. By default it is calculated as min(len(X), int(1500 * np.log(len(X)) / (np.log(len(X)) + np.log(100)))). So that any datasets with less than about 900 data points (cells) will use full data for vector field reconstruction while any dataset larger than that will at most use 1500 data points.

  • a (float (default 5)) – Parameter of the model of outliers. We assume the outliers obey uniform distribution, and the volume of outlier’s variation space is a.

  • beta (float (default: None)) – Parameter of Gaussian Kernel, k(x, y) = exp(-beta*||x-y||^2). If None, a rule-of-thumb bandwidth will be computed automatically.

  • ecr (float (default: 1e-5)) – The minimum limitation of energy change rate in the iteration process.

  • gamma (float (default: 0.9)) – Percentage of inliers in the samples. This is an inital value for EM iteration, and it is not important. Default value is 0.9.

  • lambda (float (default: 3)) – Represents the trade-off between the goodness of data fit and regularization.

  • minP (float (default: 1e-5)) – The posterior probability Matrix P may be singular for matrix inversion. We set the minimum value of P as minP.

  • MaxIter (int (default: 500)) – Maximum iteration times.

  • theta (float (default 0.75)) – Define how could be an inlier. If the posterior probability of a sample is an inlier is larger than theta, then it is regarded as an inlier.

  • div_cur_free_kernels (bool (default: False)) – A logic flag to determine whether the divergence-free or curl-free kernels will be used for learning the vector field.

  • sigma (int) – Bandwidth parameter.

  • eta (int) – Combination coefficient for the divergence-free or the curl-free kernels.

  • seed (int or 1-d array_like, optional (default: 0)) – Seed for RandomState. Must be convertible to 32 bit unsigned integers. Used in sampling control points. Default is to be 0 for ensure consistency between different runs.

__init__(X=None, V=None, Grid=None, *args, **kwargs)[source]

Initialize the VectorField class.

Parameters
  • X (ndarray (dimension: n_obs x n_features)) – Original data.

  • V (ndarray (dimension: n_obs x n_features)) – Velocities of cells in the same order and dimension of X.

  • Grid (ndarray) – The function that returns diffusion matrix which can be dependent on the variables (for example, genes)

  • M (int (default: None)) – The number of basis functions to approximate the vector field. By default it is calculated as min(len(X), int(1500 * np.log(len(X)) / (np.log(len(X)) + np.log(100)))). So that any datasets with less than about 900 data points (cells) will use full data for vector field reconstruction while any dataset larger than that will at most use 1500 data points.

  • a (float (default 5)) – Parameter of the model of outliers. We assume the outliers obey uniform distribution, and the volume of outlier’s variation space is a.

  • beta (float (default: None)) – Parameter of Gaussian Kernel, k(x, y) = exp(-beta*||x-y||^2). If None, a rule-of-thumb bandwidth will be computed automatically.

  • ecr (float (default: 1e-5)) – The minimum limitation of energy change rate in the iteration process.

  • gamma (float (default: 0.9)) – Percentage of inliers in the samples. This is an inital value for EM iteration, and it is not important. Default value is 0.9.

  • lambda (float (default: 3)) – Represents the trade-off between the goodness of data fit and regularization.

  • minP (float (default: 1e-5)) – The posterior probability Matrix P may be singular for matrix inversion. We set the minimum value of P as minP.

  • MaxIter (int (default: 500)) – Maximum iteration times.

  • theta (float (default 0.75)) – Define how could be an inlier. If the posterior probability of a sample is an inlier is larger than theta, then it is regarded as an inlier.

  • div_cur_free_kernels (bool (default: False)) – A logic flag to determine whether the divergence-free or curl-free kernels will be used for learning the vector field.

  • sigma (int) – Bandwidth parameter.

  • eta (int) – Combination coefficient for the divergence-free or the curl-free kernels.

  • seed (int or 1-d array_like, optional (default: 0)) – Seed for RandomState. Must be convertible to 32 bit unsigned integers. Used in sampling control points. Default is to be 0 for ensure consistency between different runs.

Methods

__init__([X, V, Grid])

Initialize the VectorField class.

assign_fixed_points([domain, cores])

assign each cell to the associated fixed points

compute_acceleration([X, method])

compute_curl([X, method, dim1, dim2, dim3])

compute_curvature([X, method, formula])

compute_divergence([X, method])

compute_sensitivity([X, method])

compute_torsion([X, method])

construct_graph([X])

evaluate(CorrectIndex, VFCIndex, siz)

Evaluate the precision, recall, corrRate of the sparseVFC algorithm.

find_fixed_points([n_x0, X0, domain, ...])

Search for fixed points of the vector field function.

from_adata(adata[, basis, vf_key])

get_Jacobian([method, input_vector_convention])

Get the Jacobian of the vector field function.

get_V([idx])

get_X([idx])

get_data()

get_fixed_points(**kwargs)

Get fixed points of the vector field function.

integrate(init_states[, dims, scale, t_end, ...])

plot_energy([figsize, fig])

train([normalize])

Learn an function of vector field from sparse single cell samples in the entire space robustly.