moscot.problems.space.MappingProblem.solve¶
- MappingProblem.solve(alpha=0.5, epsilon=0.01, tau_a=1.0, tau_b=1.0, rank=-1, scale_cost='mean', batch_size=None, stage=('prepared', 'solved'), initializer=None, initializer_kwargs=mappingproxy({}), jit=True, min_iterations=None, max_iterations=None, threshold=0.001, linear_solver_kwargs=mappingproxy({}), device=None, **kwargs)[source]¶
Solve the mapping problem.
See also
See Mapping gene expression in space on how to prepare and solve the
MappingProblem.
- Parameters:
alpha (
float) – Parameter in \((0, 1]\) that interpolates between the quadratic term and the linear term. \(\alpha = 1\) corresponds to the pure Gromov-Wasserstein problem while \(\alpha \to 0\) corresponds to the pure linear problem.epsilon (
float) – Entropic regularization.tau_a (
float) – Parameter in \((0, 1]\) that defines how much unbalanced is the problem on the source marginals. If \(1\), the problem is balanced.tau_b (
float) – Parameter in \((0, 1]\) that defines how much unbalanced is the problem on the target marginals. If \(1\), the problem is balanced.rank (
int) – Rank of the low-rank OT solver [Scetbon et al., 2021, Scetbon et al., 2021]. If \(-1\), full-rank solver [Cuturi, 2013, Peyré et al., 2016] is used.scale_cost (
Union[float,Literal['mean','max_cost','max_bound','max_norm','median']]) – How to re-scale the cost matrices. If afloat, the cost matrices will be re-scaled as \(\frac{\text{cost}}{\text{scale_cost}}\).batch_size (
Optional[int]) – Number of rows/columns of the cost matrix to materialize during the solver iterations. Larger value will require more memory.stage (
Union[Literal['prepared','solved'],Tuple[Literal['prepared','solved'],...]]) – Stage by which to filter theproblemsto be solved.initializer (
Union[BaseQuadraticInitializer,None,SinkhornInitializer,Literal['default','gaussian','sorting']]) – How to initialize the solution. IfNone,'default'will be used for a full-rank solver and'rank2'for a low-rank solver.initializer_kwargs (
Mapping[str,Any]) – Keyword arguments for theinitializer.min_iterations (
Optional[int]) – Minimum number of (fused) GW or Sinkhorn iterations, depending on alpha.max_iterations (
Optional[int]) – Maximum number of (fused) GW or Sinkhorn iterations, depending on alpha.threshold (
float) – Convergence threshold of the GW or the Sinkhorn algorithm, depending on alpha.linear_solver_kwargs (
Mapping[str,Any]) – Keyword arguments for the inner linear problem solver. Only used when alpha > 0.device (
Optional[Literal['cpu','gpu','tpu']]) – Transfer the solution to a different device, seeto(). IfNone, keep the output on the original device.**kwargs (
Any) – The description is missing.
- Return type:
MappingProblem[TypeVar(K, bound=Hashable)]- Returns:
: Returns self and updates the following fields: