Closed philbangayan closed 3 years ago
Chapter 3: I have an error at the same location.missing However, it does load as i get this ok X, y = mnist["data"], mnist["target"] X.shape
I cloned the book notebooks directly and doesnt work in the books notebooks, not just my own version, so not sure what i'm missing , all else workng to that point so cant see what import/instal is missing ? However, the following from the Jup Notebok is not working and returns a .....KeyError: 0
some_digit = X[0] some_digit_image = some_digit.reshape(28, 28) plt.imshow(some_digit_image, cmap=mpl.cm.binary) plt.axis("off")
save_fig("some_digit_plot") plt.show()
I found a workaround from another thread here titled "mnist dataset." (link)
The post suggests using these lines:
from tensorflow.keras.datasets import mnist (X_train, y_train), (X_test, y_test) = mnist.load_data()
There are a few differences between using mnist.load_data() and fetch_openml('mnist_784', version=1):
some_digit = X_train[0]
X_train = X_train.reshape(60000, 28*28)
and X_test = X_test.reshape(10000, 28*28)
y = t_train.astype(np.uint8)
I had the same problem. You could use this: mnist = fetch_openml('mnist_784', parser='auto')
I tried to run this line from the beginning of Chapter 3: mnist = fetch_openml('mnist_784', version=1)
and got this error: ValueError: Dataset mnist_784 with version 1 not found.
I tried removing the second parameter or changing the dataset name to 'MNIST original', but neither worked. I'm running sys 3.8.5 and sklearn 0.23.2. Anyone else having this problem?