本文整理汇总了Python中sklearn.manifold.TSNE.get_params方法的典型用法代码示例。如果您正苦于以下问题:Python TSNE.get_params方法的具体用法?Python TSNE.get_params怎么用?Python TSNE.get_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.manifold.TSNE
的用法示例。
在下文中一共展示了TSNE.get_params方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_clusters
# 需要导入模块: from sklearn.manifold import TSNE [as 别名]
# 或者: from sklearn.manifold.TSNE import get_params [as 别名]
def show_clusters(data, y, name, params=None):
model = TSNE(n_components=2, random_state=0)
np.set_printoptions(suppress=True)
if params is not None:
model.set_params(**params)
X = model.fit_transform(data)
print X
p = model.get_params()
print "X.shape = ", X.shape
print "y.shape = ", y.shape
print y
plt.scatter(X[:,0], X[:,1], c=y)
plt.gray()
plt.axis('off')
plt.show()
plt.savefig("ClustersUntrained{}.png".format(name), dpi=600)
plt.clf()
return p
示例2:
# 需要导入模块: from sklearn.manifold import TSNE [as 别名]
# 或者: from sklearn.manifold.TSNE import get_params [as 别名]
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 10 14:30:42 2014
@author: junhao
"""
import numpy as np
import pandas as pd
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
df = pd.read_csv('iris.data',delimiter=',', header=None)
df = df.dropna()
print df.head()
c= df.iloc[:,4]
f = pd.Categorical.from_array(c)
print f.labels
model=TSNE(n_components=2, init='random', early_exaggeration=4, learning_rate=200, random_state=1)
xy= model.fit_transform(df.iloc[:,0:3])
plt.scatter(xy[:,0],xy[:,1], c=f.labels)
ax.legend()
plt.show()
print model.get_params()