def mean_std_rand(labels_all): # labels_all is nvert x nsub matrix # delete subjects for which parcellation is not done labs1 = labels_all ind = (sp.sum(labs1, axis=0) != 0) labs1 = labs1[:, ind] labs = reorder_labels(labs1) labs_mode, freq = sp.stats.mode(labs, axis=1) freq1 = sp.double(freq.squeeze()) freq1 /= labs.shape[1] ars = sp.zeros(labs.shape[1]) for ind in range(labs.shape[1]): ars[ind] = adjusted_rand_score(labs_mode.squeeze(), labs[:, ind]) return ars.mean(), ars.std(), freq1, labs_mode
a2009s.32k_fs.reduce3.very_smooth.left.dfs')) count1 = 0 rho_rho = [] rho_all = [] s1 = sp.load('labs_all_split2_data_1common_30clusters.npz') l = s1['lab_sub1'] l1 = sp.reshape(l, (l.shape[0] * l.shape[1]), order='F') l = s1['lab_sub2'] l2 = sp.reshape(l, (l.shape[0] * l.shape[1]), order='F') l12 = sp.concatenate((l1[:, None], l2[:, None]), axis=1) print sp.sum(sp.absolute(l12[:, 1] - l12[:, 0])) l12 = reorder_labels(l12) print sp.sum(sp.absolute(l12[:, 1] - l12[:, 0])) l1 = sp.reshape(l12[:, 0], (l.shape[0], l.shape[1]), order='F') l2 = sp.reshape(l12[:, 1], (l.shape[0], l.shape[1]), order='F') perm1 = sp.mod(17 * sp.arange(max(l1.flatten()) + 1), max(l1.flatten()) + 1) # Plot labels ind = 19 ind2 = 0 lab1 = l1[:, ind] lab2 = l2[:, ind2] nVert = dfs_left_sm.vertices.shape[0]
print sp.sum(sp.absolute(l12[:, 1] - l12[:, 0])) print sp.sum(sp.absolute(l12[:, 1] - l12[:, 0])) l1 = sp.reshape(l12[:, 0], (l.shape[0], 40), order='F') l2 = sp.reshape(l12[:, 1], (l.shape[0], 40), order='F') #perm1 = sp.mod(19*sp.arange(max(l1.flatten())+1), max(l1.flatten())+1) nVert = l.shape[0] #cat_data = s1['cat_data'] for ind in range(30): lab1 = l1[:, ind] lab2 = l2[:, ind] tlab[:, 1] = lab1 lab22, ind1 = reorder_labels(tlab) lab1 = ind1[sp.int16(lab1), 1] lab2 = ind1[sp.int16(lab2), 1] dfs_left_sm.labels = lab1 s = sp.ones( nVert) #silhouette_samples(cat_data[nVert*(ind):nVert*(ind+1), :], # dfs_left_sm.labels) s[s < 0] = 0 s = s / sp.median(s) s[s > 1.0] = 1.0 dfs_left_sm = patch_color_labels(dfs_left_sm, shuffle=False) view_patch_vtk(dfs_left_sm, azimuth=90, elevation=180, roll=90,