Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

fmralign.embeddings.parcellation.get_adjacency_from_labels

fmralign.embeddings.parcellation.get_adjacency_from_labels(labels)[source]

Creates a sparse matrix where element (i,j) is 1 if labels[i] == labels[j], 0 otherwise.

Parameters:
labels: ndarray of shape (n,)

1D array of integers

Returns:
sparse_matrix: sparse scipy.sparse.coo_matrix

of shape (len(labels), len(labels))