class sklearn.manifold.TSNE(n_components=2, perplexity=30.0, early_exaggeration=12.0, learning_rate=200.0, n_iter=1000, n_iter_without_progress=300, min_grad_norm=1e07, metric=’euclidean’, init=’random’, verbose=0, random_state=None, method=’barnes_hut’, angle=0.5)
[source]
tdistributed Stochastic Neighbor Embedding.
tSNE [1] is a tool to visualize highdimensional data. It converts similarities between data points to joint probabilities and tries to minimize the KullbackLeibler divergence between the joint probabilities of the lowdimensional embedding and the highdimensional data. tSNE has a cost function that is not convex, i.e. with different initializations we can get different results.
It is highly recommended to use another dimensionality reduction method (e.g. PCA for dense data or TruncatedSVD for sparse data) to reduce the number of dimensions to a reasonable amount (e.g. 50) if the number of features is very high. This will suppress some noise and speed up the computation of pairwise distances between samples. For more tips see Laurens van der Maaten’s FAQ [2].
Read more in the User Guide.
Parameters: 


Attributes: 

>>> import numpy as np >>> from sklearn.manifold import TSNE >>> X = np.array([[0, 0, 0], [0, 1, 1], [1, 0, 1], [1, 1, 1]]) >>> X_embedded = TSNE(n_components=2).fit_transform(X) >>> X_embedded.shape (4, 2)
fit (X[, y])  Fit X into an embedded space. 
fit_transform (X[, y])  Fit X into an embedded space and return that transformed output. 
get_params ([deep])  Get parameters for this estimator. 
set_params (**params)  Set the parameters of this estimator. 
__init__(n_components=2, perplexity=30.0, early_exaggeration=12.0, learning_rate=200.0, n_iter=1000, n_iter_without_progress=300, min_grad_norm=1e07, metric=’euclidean’, init=’random’, verbose=0, random_state=None, method=’barnes_hut’, angle=0.5)
[source]
fit(X, y=None)
[source]
Fit X into an embedded space.
Parameters: 


fit_transform(X, y=None)
[source]
Fit X into an embedded space and return that transformed output.
Parameters: 


Returns: 

get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: 


Returns: 

n_iter_final
DEPRECATED: Attribute n_iter_final was deprecated in version 0.19 and will be removed in 0.21. Use n_iter_
instead
set_params(**params)
[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: 


sklearn.manifold.TSNE
© 2007–2018 The scikitlearn developers
Licensed under the 3clause BSD License.
http://scikitlearn.org/stable/modules/generated/sklearn.manifold.TSNE.html