partitions.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:neoSBM 作者: piratepeel 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号