2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

t-SNE

2
Last updated at Posted at 2017-05-24

3次元の配列を2次元にする

import numpy as np
from sklearn.manifold import TSNE

# 3次元の配列を2次元にする
X = np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]])

model = TSNE(n_components=2, random_state=0)
np.set_printoptions(suppress=True)
result = model.fit_transform(X) 

print( result )
[[ 0.00017599  0.00003993]
 [ 0.00009891  0.00021913]
 [ 0.00018554 -0.00009357]
 [ 0.00009528 -0.00001407]]

n次元の配列を3次元にする

import numpy as np
from sklearn.manifold import TSNE

# 5次元の配列を3次元にする
X = np.array([[0, 0, 0, 0, 0], [0, 1, 1, 0, 0], [1, 0, 1, 0, 0], [1, 1, 1, 0, 0]])

model = TSNE(n_components=3, random_state=0)
np.set_printoptions(suppress=True)
result = model.fit_transform(X) 

print( result )
[[ 0.00017664  0.00004092  0.00010137]
 [ 0.00022378  0.0001879  -0.00010256]
 [ 0.00009511 -0.00001756 -0.00001262]
 [ 0.00004055  0.00001404  0.00014699]]

sklearn.manifold.TSNE — scikit-learn 0.18.1 documentation
http://scikit-learn.org/stable/modules/generated/sklearn.manifold.TSNE.html

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?