高維度資料的 t-SNE 視覺化

Python 的降維

Jeroen Boeye

Head of Machine Learning, Faktion

IRIS 資料集的 t-SNE

鳶尾花叢集

Python 的降維

IRIS 資料集的 t-SNE

鳶尾花叢集 1 標註

Python 的降維

IRIS 資料集的 t-SNE

鳶尾花叢集 3 標註

Python 的降維

女性 ANSUR 資料集的 t-SNE

df.shape
(1986, 99)
non_numeric = ['BMI_class', 'Height_class', 
               'Gender',  'Component', 'Branch']

df_numeric = df.drop(non_numeric, axis=1)

df_numeric.shape
(1986, 94)
Python 的降維

擬合 t-SNE

from sklearn.manifold import TSNE

m = TSNE(learning_rate=50)
tsne_features = m.fit_transform(df_numeric)

tsne_features[1:4,:]
array([[-37.962185,  15.066088],
       [-21.873512,  26.334448],
       [ 13.97476 ,  22.590828]], dtype=float32)
Python 的降維

將 t-SNE 特徵指派到資料集

tsne_features[1:4,:]
array([[-37.962185,  15.066088],
       [-21.873512,  26.334448],
       [ 13.97476 ,  22.590828]], dtype=float32)
df['x'] = tsne_features[:,0]

df['y'] = tsne_features[:,1]
Python 的降維

繪製 t-SNE 圖

import seaborn as sns

sns.scatterplot(x="x", y="y", data=df)

plt.show()
Python 的降維

繪製 t-SNE 圖

ANSUR 點雲

Python 的降維

依 BMI 類別著色

import seaborn as sns
import matplotlib.pyplot as plt

sns.scatterplot(x="x", y="y", hue='BMI_class', data=df)

plt.show()
Python 的降維

依 BMI 類別著色

ANSUR 點雲(BMI)

Python 的降維

依 BMI 類別著色

ANSUR 點雲(BMI 標註)

Python 的降維

依身高類別著色

import seaborn as sns

import matplotlib.pyplot as plt

sns.scatterplot(x="x", y="y", hue='Height_class', data=df)

plt.show()
Python 的降維

依身高類別著色

ANSUR 點雲(身高)

Python 的降維

依身高類別著色

ANSUR 點雲(雙重標註)

Python 的降維

一起來練習吧!

Python 的降維

Preparing Video For Download...