如何在t-SNE嵌入后获得概率分布中的最终KL-分歧?我正在使用sklearn.manifold包中的TSNE函数。我可以访问哪些参数吗?
答案 0 :(得分:2)
拟合模型有一个名为kl_divergence _的属性。(见documentation)。
答案 1 :(得分:1)
您可以使用的技巧是设置TSNE功能的参数“verbose”。使用verbose = 2,您将获得以下输出:
[t-SNE] Computing pairwise distances...
[t-SNE] Computing 91 nearest neighbors...
[t-SNE] Computed conditional probabilities for sample 1000 / 1262
[t-SNE] Computed conditional probabilities for sample 1262 / 1262
[t-SNE] Mean sigma: 0.000000
[t-SNE] Iteration 25: error = 0.8776680, gradient norm = 0.0074852
[t-SNE] Iteration 50: error = 0.6590481, gradient norm = 0.0073444
[t-SNE] Iteration 75: error = 0.2875383, gradient norm = 0.0039135
[t-SNE] Iteration 100: error = 0.2597728, gradient norm = 0.0032396
[t-SNE] Error after 100 iterations with early exaggeration: 0.259773
[t-SNE] Iteration 125: error = 0.2333734, gradient norm = 0.0030973
[t-SNE] Iteration 150: error = 0.2164318, gradient norm = 0.0045540
[t-SNE] Iteration 175: error = 0.2175926, gradient norm = 0.0035685
[t-SNE] Iteration 200: error = 0.2102150, gradient norm = 0.0041453
[t-SNE] Iteration 225: error = 0.2186255, gradient norm = 0.0040576
[t-SNE] Iteration 250: error = 0.2160356, gradient norm = 0.0036579
[t-SNE] Iteration 250: did not make any progress during the last 30 episodes. Finished.
[t-SNE] Error after 250 iterations: 0.216036
虽然您没有将KL的值存储为变量,但您可以比较不同的解决方案并选择具有最低KL的解决方案。