カーネル主成分分析を使った非線形写像
// TODO P162 理論はあとで、、
Coding(scikit-learn)
code: Python
from sklearn.datasets import make_moons
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)
%matplotlib inline
import matplotlib.pyplot as plt
plt.scatter(X_skernpcay==0, 0, X_skernpcay==0, 1, color='red', marker='^', alpha=0.5) plt.scatter(X_skernpcay==1, 0, X_skernpcay==1, 1, color='blue', marker='o', alpha=0.5) plt.xlabel('PC1')
plt.ylabel('PC2')
plt.tight_layout()
plt.show()
https://gyazo.com/108bd1f3a32c4045d181ded99a368310