如何在tsne情节中找到具体点?

时间:2017-10-04 00:14:04

标签: python numpy matplotlib machine-learning scikit-learn

我正在使用python查看tsne情节,并希望找到特定异常值的索引。 tsne图看起来像这样:

image description

有没有办法找出情节中的特定异常指数?

我用来生成tsne图的代码:

tsne = manifold.TSNE(n_components=2, init= "pca",random_state=0)
ip1_tsne = tsne.fit_transform(feat)
import matplotlib.pyplot as plt

print 'Processing tSNE complete'

ip1_tsne_display = ip1_tsne #[display_indices]
labels_display = labels #[display_indices]

classNames = ['Oribi', 'Nyala', 'Waterbuck', 'Elephant', 'Baboon', 'Porcupine', 'Impala', 'Genet', 'Bushbuck', 'Warthog']

print_classes = 10
cmap = plt.get_cmap('nipy_spectral')
colors = cmap(np.linspace(0, 1.0, print_classes))
test_colors = colors;
colors = (colors + np.ones(colors.shape))/2.0

f = plt.figure(figsize=(8,8))

for label, color, className in zip(xrange(1,10), test_colors, classNames):
    plt.plot(ip1_tsne_display[labels_display == label, 0], ip1_tsne_display[labels_display == label, 1],
            'o', markersize=1.5, label=className, color=color)

plt.legend()
#plt.savefig('tsne.png')

plt.show()
f.savefig("tsne_fc7.pdf", bbox_inches='tight')

0 个答案:

没有答案