Skip to content

Commit c784d32

Browse files
committed
remove faces pca n_components=2000 that's not shown
breaks with sklearn 0.20 because n_components larger than rank.
1 parent cccbbca commit c784d32

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mglearn/plot_pca.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ def plot_pca_whitening():
9494
@memory.cache
9595
def pca_faces(X_train, X_test):
9696
# copy and pasted from nmf. refactor?
97-
# Build NMF models with 10, 50, 100, 500 and 2000 components
97+
# Build NMF models with 10, 50, 100, 500 components
9898
# this list will hold the back-transformd test-data
9999
reduced_images = []
100-
for n_components in [10, 50, 100, 500, 2000]:
100+
for n_components in [10, 50, 100, 500]:
101101
# build the NMF model
102102
pca = PCA(n_components=n_components)
103103
pca.fit(X_train)
@@ -126,5 +126,5 @@ def plot_pca_faces(X_train, X_test, image_shape):
126126

127127
# label the top row
128128
axes[0, 0].set_title("original image")
129-
for ax, n_components in zip(axes[0, 1:], [10, 50, 100, 500, 2000]):
129+
for ax, n_components in zip(axes[0, 1:], [10, 50, 100, 500]):
130130
ax.set_title("%d components" % n_components)

0 commit comments

Comments
 (0)