deepof.utils.cluster_transition_matrix

deepof.utils.cluster_transition_matrix(cluster_sequence: array, nclusts: int, autocorrelation: bool = True, return_graph: bool = False) Tuple[Graph | Any, ndarray]

Compute the transition matrix between clusters and the autocorrelation in the sequence.

Parameters:
  • cluster_sequence (numpy.array) – Sequence of cluster assignments.

  • nclusts (int) – Number of clusters in the sequence.

  • autocorrelation (bool) – Whether to compute the autocorrelation of the sequence.

  • return_graph (bool) – Whether to return the transition matrix as an networkx.DiGraph object.

Returns:

Transition matrix as numpy.ndarray or networkx.DiGraph. autocorr (numpy.array): If autocorrelation is True, returns a numpy.ndarray with all autocorrelation values on cluster assignment.

Return type:

trans_normed (numpy.ndarray / networkx.Graph)