Unsupervised Learning bằng Python
Benjamin Wilson
Director of Research at lateral.io

PCA là một thành phần scikit-learn như KMeans hoặc StandardScalerfit() học phép biến đổi từ dữ liệu đưa vàotransform() áp dụng phép biến đổi đã họctransform() cũng áp dụng cho dữ liệu mớisamples = mảng gồm hai đặc trưng (total_phenols & od280)[[ 2.8 3.92]
...
[ 2.05 1.6 ]]
from sklearn.decomposition import PCAmodel = PCA() model.fit(samples)
PCA()
transformed = model.transform(samples)
print(transformed)
[[ 1.32771994e+00 4.51396070e-01]
[ 8.32496068e-01 2.33099664e-01]
...
[ -9.33526935e-01 -4.60559297e-01]]
total_phenols và od280


components_ của đối tượng PCAprint(model.components_)
[[ 0.64116665 0.76740167]
[-0.76740167 0.64116665]]
Unsupervised Learning bằng Python