Mngơi nghỉ đầu.
Bạn đang xem: Principal component analysis là gì
Đây là thuật tân oán hình thành nhằm xử lý vấn đề dữ liệu gồm rất nhiều chiều tài liệu, đề xuất giảm bớt chiều dữ liệu nhằm mục tiêu tăng tốc độ xử lý, nhưng mà vẫn giữ giàng báo cáo các tuyệt nhất có thể (high variance).
Chúng ta đề nghị đưa ra chiều tài liệu gồm độ đặc trưng cao, nhằm giảm bớt bài toán tính tân oán, cũng giống như tăng vận tốc cập nhật.
Dữ liệu.
Chúng ta đề xuất phân biệt 2 nhiều loại dữ liệu:
Dữ liệu liên quan (correlated):

PCA tìm ra mean và principal components.


Làm cố như thế nào để implement PCA:
Biến thay đổi X về dạng đồng hóa.Tính toán thù covariance matrix ΣTìm eigenvectors của ΣLấy K dimensions có giá trị variance cao nhấteigenvectors (vector color đỏ)
là vector không biến hóa phía Khi apply linear transformation.

eigenvalue đến PC1

eigenvalue mang lại PC2

eigenvector

Sự phân chia độ đặc biệt của chiều dữ liệu


Algorithm
from numpy import arrayfrom numpy import meanfrom numpy import covfrom numpy.linalg import eig# define a matrixA = array(<<1, 2>, <3, 4>, <5, 6>>)print(A)# calculate the mean of each columnM = mean(A.T, axis=1)print(M)# center columns by subtracting column meansC = A - Mprint(C)# calculate covariance matrix of centered matrixV = cov(C.T)print(V)# eigendecomposition of covariance matrixvalues, vectors = eig(V)print(vectors)print(values)# project dataP. = vectors.T.dot(C.T)print(P.T)Output:

