mglearn.plots.plot_pca_faces(X_train, X_test, image_shape)
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
您的邮件已收到,我将会尽快处理,谢谢。王宇凝
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.
您的邮件已收到,我将会尽快处理,谢谢。王宇凝
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
imshowfunction is called in this function,You can setvmax=255,or directly deletevminandvmax. After that the image will be displayed normally.
Deleting vmin and vmax will do the trick, thanks