ageron / handson-ml2

A series of Jupyter notebooks that walk you through the fundamentals of Machine Learning and Deep Learning in Python using Scikit-Learn, Keras and TensorFlow 2.
Apache License 2.0
27.88k stars 12.75k forks source link

unable to load MNIST data using fetch_openml() #356

Closed philbangayan closed 3 years ago

philbangayan commented 3 years ago

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?

DavidHeavey commented 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

(70000, 784)

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()

philbangayan commented 3 years ago

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):

gjcasanova commented 10 months ago

I had the same problem. You could use this: mnist = fetch_openml('mnist_784', parser='auto')