moscot.problems.spatiotemporal.SpatioTemporalProblem.cell_transition¶
- SpatioTemporalProblem.cell_transition(source, target, source_groups, target_groups, forward=False, aggregation_mode='annotation', batch_size=None, normalize=True, key_added='cell_transition')¶
Aggregate the transport matrix.
See also
See Cell transitions on how to compute and
plot
the cell transitions.
- Parameters:
source (
TypeVar
(K
, bound=Hashable
)) – Key identifying the source distribution.target (
TypeVar
(K
, bound=Hashable
)) – Key identifying the target distribution.source_groups (
Union
[str
,Mapping
[str
,Sequence
[Any
]],None
]) –Source groups used for aggregation. Valid options are:
target_groups (
Union
[str
,Mapping
[str
,Sequence
[Any
]],None
]) –Target groups used for aggregation. Valid options are:
aggregation_mode (
Literal
['annotation'
,'cell'
]) –How to aggregate the cell-level transport maps. Valid options are:
'annotation'
- group the transitions by thesource_groups
and thetarget_groups
.'cell'
- do not group by thesource_groups
or thetarget_groups
, depending on theforward
.
forward (
bool
) – IfTrue
, compute the transitions from thesource_groups
to thetarget_groups
.batch_size (
Optional
[int
]) – Number of rows/columns of the cost matrix to materialize duringpush()
orpull()
. Larger value will require more memory.normalize (
bool
) – IfTrue
, normalize the transition matrix. Ifforward = True
, the transition matrix will be row-stochastic, otherwise column-stochastic.key_added (
Optional
[str
]) – Key inuns
where to save the result.self (TemporalMixinProtocol[K, B])
- Return type:
- Returns:
: Depending on the
key_added
:None
- returns the transition matrix.str
- returns nothing and saves the transition matrix touns['moscot_results']['cell_transition']['{key_added}']