Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在tsne图中找到特定点?_Python_Numpy_Matplotlib_Machine Learning_Scikit Learn - Fatal编程技术网

Python 如何在tsne图中找到特定点?

Python 如何在tsne图中找到特定点?,python,numpy,matplotlib,machine-learning,scikit-learn,Python,Numpy,Matplotlib,Machine Learning,Scikit Learn,我使用python查看tsne图,并希望找到特定异常值的索引。tsne图如下所示: 有没有办法找出绘图上的特定异常值指数 我用于生成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_t

我使用python查看tsne图,并希望找到特定异常值的索引。tsne图如下所示:

有没有办法找出绘图上的特定异常值指数

我用于生成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')

您可以在点上使用选择器。请参阅或大体上。一个不太优雅但快速的解决方案是使用如下内容:
np。其中((ip1_-tsne[:,0]>20)和(ip1_-tsne[:,0]>20))
您可以在点上使用选择器。请参阅或大体上。一个不太优雅但快速的解决方案是使用如下内容:
np.where((ip1_-tsne[:,0]>20)和(ip1_-tsne[:,0]>20))