■ t-SNE 시각화 알고리즘을 사용하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import matplotlib.pyplot as pp import numpy as np import sklearn.datasets as datasets import sklearn.manifold as manifold mnistBunch = datasets.load_digits(n_class = 6) imageNDArray = mnistBunch.data labelNDArray = mnistBunch.target tsneNDArray = manifold.TSNE(n_components = 2, init = "pca", random_state = 0).fit_transform(imageNDArray) figure, axesSubplot = pp.subplots() axesSubplot.scatter(tsneNDArray[:, 0], tsneNDArray[:, 1], c = labelNDArray) axesSubplot.set_xticks(()) axesSubplot.set_yticks(()) pp.show() |