Skip to contents

Wrapper function to run `cell2cell_tensor` decomposition on a prebuilt tensor.

Usage

decompose_tensor(
  prebuilt_tensor,
  rank = NULL,
  tf_optimization = "robust",
  seed = 1337,
  upper_rank = 25,
  elbow_metric = "error",
  smooth_elbow = FALSE,
  init = "svd",
  svd = "numpy_svd",
  factors_only = TRUE,
  verbose = TRUE,
  ...
)

Arguments

prebuilt_tensor

Tensor-cell2cell Prebuilt.Tensor class instance

rank

Ranks for the Tensor Factorization (number of factors to deconvolve the original tensor). If NULL, then rank selection is performed using the `elbow_rank_selection` function.

tf_optimization

indicates whether running the analysis in the `'regular'` or the `'robust'` way. The regular way means that the tensor decomposition is run 10 times per rank evaluated in the elbow analysis, and 1 time in the final decomposition. Additionally, the optimization algorithm has less number of iterations in the regular than the robust case (100 vs 500) and less precision (tolerance of 1e-7 vs 1e-8). The robust case runs the tensor decomposition 20 times per rank evaluated in the elbow analysis, and 100 times in the final decomposition. Here we could use the `tf_optimization='regular'`, which is faster but generates less robust results. We recommend using `tf_optimization='robust`, which takes longer to run (more iteractions and more precise too).

seed

Random seed integer

upper_rank

Upper bound of ranks to explore with the elbow analysis.

init

Initialization method for computing the Tensor Factorization. ‘svd’, ‘random’

factors_only

whether to return only the factors after factorization

verbose

verbosity logical

...

Dictionary containing keyword arguments for the c2c.compute_tensor_factorization function. The function deals with `random_state` (seed) and `rank` internally.

Value

an instance of the cell2cell.tensor.BaseTensor class (via reticulate). If build_only is TRUE, then no rank selection or tensor decomposition is returned. Otherwise, returns a tensor with factorization results.