pycrostates.segmentation.compute_expected_transition_matrix#
- pycrostates.segmentation.compute_expected_transition_matrix(labels, n_clusters, stat='probability', ignore_repetitions=True)[source]#
Compute the expected transition matrix.
Compute the theoretical transition matrix as if time course was ignored, but microstate proportions was kept (i.e. shuffled segmentation). This matrix can be used to quantify/correct the effect of microstate time coverage on the observed transition matrix obtained with the
pycrostates.segmentation.compute_transition_matrix(). Transition “from” and “to” unlabeled segments-1are ignored.- Parameters:
- labels
arrayof shape(n_samples,)or(n_epochs, n_samples) Microstates labels attributed to each sample, i.e. the segmentation.
- n_clusters
int The number of clusters, i.e. the number of microstates.
- stat
str Aggregate statistic to compute transitions. Can be:
probabilityorproportion: normalize count such as the probabilities along the first axis is always equal to1.percent: normalize count such as the probabilities along the first axis is always equal to100.
- ignore_repetitions
bool If
True, ignores state repetitions. For example, the input sequenceAAABBCCDwill be transformed intoABCDbefore any calculation. This is equivalent to setting the duration of all states to 1 sample.
- labels
- Returns:
- T
arrayof shape(n_cluster, n_cluster) Array of transition probability values from one label to another. First axis indicates state
"from". Second axis indicates state"to".
- T