Kernel principal component analysis in scikit-learn
2017-04-16 16:44
351 查看
For our convenience, scikit-learn implements a kernel PCA class in the sklearn.decomposition
submodule. The usage is similar to the standard PCA class, and we can specify the kernel via the
kernel parameter .
Plot the transformed half-moon shape data onto the frst two principal components
Reference:《Python Machine Learning》
submodule. The usage is similar to the standard PCA class, and we can specify the kernel via the
kernel parameter .
from sklearn.decomposition import KernelPCA X, y = make_moons(n_samples=100, random_state=123) scikit_kpca = KernelPCA(n_components=2, kernel='rbf', gamma=15) X_skernpca = scikit_kpca.fit_transform(X)
Plot the transformed half-moon shape data onto the frst two principal components
plt.scatter(X_skernpca[y == 0, 0], X_skernpca[y == 0, 1], color='red', marker='^', alpha=0.5) plt.scatter(X_skernpca[y == 1, 0], X_skernpca[y == 1, 1], color='blue', marker='o', alpha=0.5) plt.xlabel('PC1') plt.ylabel('PC2') plt.show()
Reference:《Python Machine Learning》
相关文章推荐
- scikit-learn---PCA(Principle Component Analysis)---KNN(image classifier)
- 【转载】Implementing a Principal Component Analysis (PCA) in Python step by step
- Using kernel principal component analysis for nonlinear mappings
- Implementing a Principal Component Analysis (PCA) in Python step by step
- Principal component analysis in Matlab
- Implementing a Principal Component Analysis (PCA) in Python step by step
- 核主成分分析(Kernel Principal Component Analysis, KPCA)的公式推导过程
- 解释一下核主成分分析(Kernel Principal Component Analysis, KPCA)的公式推导过程~
- 解释一下核主成分分析(Kernel Principal Component Analysis, KPCA)的公式推导过程~
- Programming Exercise 7:K-means Clustering and Principal Component Analysis (第二部分PCA)
- Stanford 机器学习 Week8 作业:K-means Clustering and Principal Component Analysis
- 笔记:Online robust principal component analysis via truncated nuclear norm regularization
- Machine Leanring-Principal Component Analysis(PCA)
- ML 14 part2 principal component analysis
- matlab学习:人脸识别之PCA( Principal Component Analysis )
- 主成分分析(Principal Component Analysis)
- Tools for Machine Learning in Python(scikit-learn)
- PCA(Principal Component Analysis)
- SAS:主成分分析(Principal Component Analysis,PCA)
- Principal component analysis(PCA)主成分分析