% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/liana_tensor.R
\name{decompose_tensor}
\alias{decompose_tensor}
\title{Wrapper function to run `cell2cell_tensor` decomposition on a prebuilt tensor.}
\usage{
decompose_tensor(
  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{
\item{tensor}{Tensor-cell2cell Prebuilt.Tensor class instance}

\item{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.}

\item{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).}

\item{seed}{Random seed integer}

\item{upper_rank}{Upper bound of ranks to explore with the elbow analysis.}

\item{init}{Initialization method for computing the Tensor Factorization.
{‘svd’, ‘random’}}

\item{factors_only}{whether to return only the factors after factorization}

\item{verbose}{verbosity logical}

\item{...}{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.
}
\description{
Wrapper function to run `cell2cell_tensor` decomposition on a prebuilt tensor.
}
