Skip to content

Commit 4962500

Browse files
committed
Example suggestions
1 parent 993b215 commit 4962500

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

examples/pcovc/KPCovC_Comparison.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@
8181
#
8282
# PCA and PCovC
8383
# -------------
84+
#
85+
# Both PCA and PCovC fail to produce linearly separable latent space
86+
# maps. We will need a kernel method to effectively separate the moon classes.
8487

8588
mixing = 0.10
8689
alpha_d = 0.5
@@ -99,11 +102,7 @@
99102
fig, axs = plt.subplots(1, 2, figsize=(10, 4))
100103

101104
for ax, model in zip(axs, models):
102-
t_train = (
103-
model.fit_transform(X_train_scaled)
104-
if isinstance(model, PCA)
105-
else model.fit_transform(X_train_scaled, y_train)
106-
)
105+
t_train = model.fit_transform(X_train_scaled, y_train)
107106
t_test = model.transform(X_test_scaled)
108107

109108
ax.scatter(t_test[:, 0], t_test[:, 1], alpha=alpha_d, cmap=cm_bright, c=y_test)
@@ -116,6 +115,11 @@
116115
#
117116
# Kernel PCA and Kernel PCovC
118117
# ---------------------------
118+
#
119+
# A comparison of the latent spaces produced by KPCA and KPCovC is shown.
120+
# A logistic regression classifier is trained on the KPCA latent space (this is also
121+
# the default classifier used in KPCovC), and we see the comparison of the respective
122+
# decision boundaries and test data accuracy scores.
119123

120124
fig, axs = plt.subplots(1, 2, figsize=(13, 6))
121125

0 commit comments

Comments
 (0)