def embedding(vi_mat,LL,n_neighbors=10):
n_components=2
Y = manifold.MDS(n_components,dissimilarity='precomputed').fit_transform(vi_mat)
color=np.zeros(1000)
color[:6]=np.ones(6)
#~ plt.figure()
#~ plt.plot(Y[:, 0], Y[:, 1], 'k.')
#~ plt.plot(Y[-n_close:, 0], Y[-n_close:, 1], 'r.')
#~ for i in xrange(6):
#~ plt.plot(Y[i, 0], Y[i, 1], 'bo',ms=3+3*i)
#~ plt.scatter(Y[:, 0], Y[:, 1], c=LL)
fig=plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(Y[:, 0], Y[:, 1], LL[:,0], c=LL[:,0], marker='o')
fig=plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(Y[:, 0], Y[:, 1], LL[:,1], c=LL[:,1], marker='o')
return Y
#################################################################
#load known partitions
评论列表
文章目录