Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mglearn.plots.plot_pca_faces(X_train, X_test, image_shape) #182

Open
JorgeFBock opened this issue Sep 27, 2023 · 4 comments
Open

mglearn.plots.plot_pca_faces(X_train, X_test, image_shape) #182

JorgeFBock opened this issue Sep 27, 2023 · 4 comments

Comments

@JorgeFBock
Copy link

I just get 5x3 very black images with nothing but black. All codes prior to this line run smoothly and no problem
Is there any hint as to why and how to fix it? I m using "noteable". Python 3.9.

The next lines, run perfectly and the graph is as in the book:
mglearn.discrete_scatter(X_train_pca[:, 0], X_train_pca[:, 1], y_train)
plt.xlabel("First principal component")
plt.ylabel("Second principal component")

BR

Screenshot 2023-09-27 104601
@wanghedy
Copy link

wanghedy commented Sep 27, 2023 via email

@buyanahr
Copy link

Hello, I successfully solved the problem.You can find mglearn/plot_pca.py.There is a function named plot_pca_faces:

def plot_pca_faces(X_train, X_test, image_shape):
    --snip--

The imshow function is called in this function,You can set vmax=255,or directly delete vminandvmax.
After that the image will be displayed normally.

@wanghedy
Copy link

wanghedy commented Aug 1, 2024 via email

@SirBaoguoMa
Copy link

Hello, I successfully solved the problem.You can find mglearn/plot_pca.py.There is a function named plot_pca_faces:

def plot_pca_faces(X_train, X_test, image_shape):
    --snip--

The imshow function is called in this function,You can set vmax=255,or directly delete vminandvmax. After that the image will be displayed normally.

Deleting vmin and vmax will do the trick, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants