moscot.base.problems.OTProblem.prepare#
- OTProblem.prepare(xy=mappingproxy({}), x=mappingproxy({}), y=mappingproxy({}), a=None, b=None, **kwargs)[source]#
Prepare the OT problem.
Depending on which arguments are passed, the
problem_kind
will be:if only
xy
is non-empty,problem_kind = 'linear'
.if only
x
andy
are non-empty,problem_kind = 'quadratic'
.if all
xy
,x
andy
are non-empty,problem_kind = 'quadratic'
.
- Parameters:
xy (
Union
[Mapping
[str
,Any
],TaggedArray
]) – Geometry defining the linear term. If a non-emptydict
,from_adata()
will be called.x (
Union
[Mapping
[str
,Any
],TaggedArray
]) – Geometry defining the source quadratic term. If a non-emptydict
,from_adata()
will be called.y (
Union
[Mapping
[str
,Any
],TaggedArray
]) – Geometry defining the target quadratic term. If a non-emptydict
,from_adata()
will be called.a (
Union
[bool
,str
,ndarray
[Any
,dtype
[float64
]],None
]) –Source marginals. Valid options are:
b (
Union
[bool
,str
,ndarray
[Any
,dtype
[float64
]],None
]) –Target marginals. Valid options are:
kwargs (
Any
) – Keyword arguments forestimate_marginals()
whena = True
orb = True
.
- Return type:
- Returns:
: Self and updates the following fields:
xy
- geometry of shape[n, m]
defining the linear term.x
- geometry of shape[n, n]
defining the source quadratic term.y
- geometry of shape[m, m]
defining the target quadratic term.stage
- set to'prepared'
.problem_kind
- kind of the OT problem.