I am trying to read locale MNIST dataset from my computer into Juypter notebook but I am getting ModuleNotFoundError error.
I have installed utils and python-utils package.
import numpy as np
import pickle, gzip, urllib.request, json
import os.path
import matplotlib.pyplot as plt
import mnist_reader
%matplotlib inline
if not os.path.isfile('mnist.pkl.gz'):
# Load the dataset
urllib.request.urlretrieve('../../imported/', 'mnist.pkl.gz')
with gzip.open('mnist.pkl.gz', 'rb') as f:
train_set, valid_set, test_set = pickle.load(f, encoding='latin1')
train_X, train_y = train_set
valid_X, valid_y = valid_set
test_X, test_y = test_set
print(train_X.shape, train_y.shape)
print(valid_X.shape, valid_y.shape)
print(test_X.shape, test_y.shape)
print(train_X.dtype, train_y.dtype)
print(train_X[9][300], train_y[9])
print(np.min(train_y), np.max(train_y))
X_train, y_train = mnist_reader.load_mnist('data/fashion', kind='train')
X_test, y_test = mnist_reader.load_mnist('data/fashion', kind='t10k')
print(X_train.shape, y_train.shape)
print(X_train.dtype, y_train.dtype)
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 5
3 import pickle, gzip, urllib.request, json
4 import os.path
----> 5 import mnist_reader
6 #from python_utils import mnist_reader
9 if not os.path.isfile('mnist.pkl.gz'):
10 # Load the dataset
ModuleNotFoundError: No module named 'mnist_reader'
Because you haven’t installed that package…?
♦
Which package should be installed?
I don’t know. What do you think that module should be?
♦