Giảm chiều: kỹ thuật trực quan hóa

Luyện tập câu hỏi phỏng vấn Machine Learning bằng Python

Lisa Stuart

Data Scientist

Vì sao cần giảm chiều?

  1. Tăng tốc huấn luyện ML
  2. Trực quan hóa
  3. Cải thiện độ chính xác
Luyện tập câu hỏi phỏng vấn Machine Learning bằng Python

Kỹ thuật trực quan hóa

  • PCA
  • t-SNE
Luyện tập câu hỏi phỏng vấn Machine Learning bằng Python

Trực quan hóa với PCA

biểu đồ PCA

1 https://districtdatalabs.silvrback.com/principal-component-analysis-with-python
Luyện tập câu hỏi phỏng vấn Machine Learning bằng Python

Biểu đồ scree

biểu đồ scree

1 https://towardsdatascience.com/a-step-by-step-explanation-of-principal-component-analysis-b836fb9c97e2
Luyện tập câu hỏi phỏng vấn Machine Learning bằng Python

t-SNE

  • Xác suất
  • Cặp điểm dữ liệu
  • Nhúng không gian thấp
  • Vẽ biểu đồ nhúng
Luyện tập câu hỏi phỏng vấn Machine Learning bằng Python

Trực quan hóa với 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
Luyện tập câu hỏi phỏng vấn Machine Learning bằng Python

Trực quan hóa với t-SNE

biểu đồ t-sne

Luyện tập câu hỏi phỏng vấn Machine Learning bằng Python

PCA vs t-SNE: dữ liệu chữ số

PCA và t-SNE trên bộ số viết tay

1 https://towardsdatascience.com/visualising-high-dimensional-datasets-using-pca-and-t-sne-in-python-8ef87e7915b
Luyện tập câu hỏi phỏng vấn Machine Learning bằng Python

Hãy thực hành!

Luyện tập câu hỏi phỏng vấn Machine Learning bằng Python

Preparing Video For Download...