[Mne_analysis] Question about permutation_cluster_test
Eric Larson
larson.eric.d at gmail.com
Tue Nov 28 10:04:12 EST 2017
>
> In my understanding if the argument connectivity is set to None, to be
> considered part of a cluster a node needs to be connected to another node
> in horizontal or vertical direction.
>
Yep. You can get equivalent but slower behavior by using
connectivity=grid_to_graph(19,
141)
<http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.image.grid_to_graph.html>.
See the recently updated stats documentation which has a bit more detail:
https://mne-tools.github.io/dev/auto_tutorials/plot_background_statistics.html#defining-the-connectivity-neighbor-adjacency-matrix
But what I would like to do is to specify the connectivity matrix such that
> diagonals are also set to be part of the cluster. As a first attempt I
> tried to set connectivity with the following argument sparse.csr_matrix
> (np.ones((3,3))), but this gave me the error that connectivity must be of
> the correct size (I am comparing 3d arrays with the following dimensions:
> 16 x 19 x 141, where the first dimension are the number of observations)
>
Your matrix needs to specify the connectivity from each point to every
other point. Since you have 19 along one dimension and 141 along the other,
it will need to be shape (2679, 2679). grid_to_graph will give you an array
of this size, and then you'll need to add additional entries for the
elements in the array that correspond to the diagonal positions. To get a
handle on the problem, you might want to start with a smaller toy dataset
(maybe 3x3 like in the docs) so that it's easier to visualize what's
happening (e.g., plot the connectivity with
matplotlib.pyplot.imshow(connectivity)
along the way). If you get it working, it could make for a nice example to
add to MNE!
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20171128/62b6764a/attachment.html
More information about the Mne_analysis
mailing list