Hello ,

I have two X_train :

X_train1 of shape (100,170000) , X_train2 of shape (100,17000)

Xc=np.concatenate((X_train1,X_train2), axis=1)

```
mask= np.asarray(nifti_masker.mask_img_.get_data()).astype(bool)
shape = mask.shape #mask.shape(182,218,182)
connectivity = image.grid_to_graph(
n_x=shape[0], n_y=shape[1], n_z=shape[2], mask=mask).tocsr()
ward = FeatureAgglomeration(n_clusters=1000,connectivity=connectivity,linkage='ward', pooling_func=np.median)
ward.fit(Xc)
```

But there is an error :

ValueError: Wrong shape for connectivity matrix: (170000, 170000) when X is (340000, 100)

how can i do this (fit on the concatenation i.e Xc) please ?

@bthirion

and thank you very much !