import numpy as np
from sklearn.manifold import TSNE
#Machen Sie ein dreidimensionales Array zweidimensional
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]]
import numpy as np
from sklearn.manifold import TSNE
#Erstellen Sie ein 5-dimensionales Array in 3D
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