차원 축소: 시각화 기법

Python으로 연습하는 Machine Learning 면접 질문

Lisa Stuart

Data Scientist

왜 차원 축소인가?

  1. ML 학습 가속
  2. 시각화
  3. 정확도 향상
Python으로 연습하는 Machine Learning 면접 질문

시각화 기법

  • PCA
  • t-SNE
Python으로 연습하는 Machine Learning 면접 질문

PCA로 시각화

PCA 플롯

1 https://districtdatalabs.silvrback.com/principal-component-analysis-with-python
Python으로 연습하는 Machine Learning 면접 질문

스크리 플롯

스크리 플롯

1 https://towardsdatascience.com/a-step-by-step-explanation-of-principal-component-analysis-b836fb9c97e2
Python으로 연습하는 Machine Learning 면접 질문

t-SNE

  • 확률적
  • 데이터 쌍
  • 저차원 임베딩
  • 임베딩 시각화
Python으로 연습하는 Machine Learning 면접 질문

t-SNE로 시각화

# t-sne with loan data
from sklearn.manifold import TSNE
import seaborn as sns

loans =  pd.read_csv('loans_dataset.csv')

# Feature matrix
X = loans.drop('Loan Status', axis=1)

tsne = TSNE(n_components=2, verbose=1, perplexity=40)
tsne_results = tsne.fit_transform(X)

loans['t-SNE-PC-one'] = tsne_results[:,0]
loans['t-SNE-PC-two'] = tsne_results[:,1]

# t-sne viz
plt.figure(figsize=(16,10))
sns.scatterplot(
    x="t-SNE-PC-one", y="t-SNE-PC-two",
    hue="Loan Status",
    palette=sns.color_palette(["grey","blue"]),
    data=loans,
    legend="full",
    alpha=0.3
)
1 https://scikit-learn.org/stable/modules/generated/sklearn.manifold.TSNE.html
Python으로 연습하는 Machine Learning 면접 질문

t-SNE로 시각화

t-sne plot

Python으로 연습하는 Machine Learning 면접 질문

PCA vs t-SNE: 숫자 데이터

숫자 데이터셋의 PCA와 t-SNE

1 https://towardsdatascience.com/visualising-high-dimensional-datasets-using-pca-and-t-sne-in-python-8ef87e7915b
Python으로 연습하는 Machine Learning 면접 질문

연습해 봅시다!

Python으로 연습하는 Machine Learning 면접 질문

Preparing Video For Download...