visuals.py 文件源码

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

项目:VariationalAutoEncoder 作者: despoisj 项目源码 文件源码
def computeTSNEProjectionOfLatentSpace(X, encoder, display=True):
    # Compute latent space representation
    print("Computing latent space projection...")
    X_encoded = encoder.predict(X)

    # Compute t-SNE embedding of latent space
    print("Computing t-SNE embedding...")
    tsne = manifold.TSNE(n_components=2, init='pca', random_state=0)
    X_tsne = tsne.fit_transform(X_encoded)

    # Plot images according to t-sne embedding
    if display:
        print("Plotting t-SNE visualization...")
        fig, ax = plt.subplots()
        imscatter(X_tsne[:, 0], X_tsne[:, 1], imageData=X, ax=ax, zoom=0.15)
        plt.show()
    else:
        return X_tsne

# Show dataset images with T-sne projection of pixel space
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号