You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
424 B
10 lines
424 B
import numpy as np |
|
import matplotlib.pyplot as plt |
|
from sklearn.manifold import TSNE |
|
|
|
data = np.random.rand(64, 10) # 64个样本,每个样本维度为10 |
|
target = np.arange(2).repeat(32) # 生成64个标签,用于区分样本目标 |
|
t_sne_features = TSNE(n_components=2, learning_rate='auto', init='pca').fit_transform(data) |
|
plt.scatter(x=t_sne_features[:, 0], y=t_sne_features[:, 1], c=target, cmap='jet') |
|
plt.show() |
|
|
|
|