Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
In this step we will load the dataset, and then store it into train and test sets. The dataset consists of 4 files:
train-images-idx3-ubyte.gz
train-labels-idx1-ubyte.gz
t10k-images-idx3-ubyte.gz
t10k-labels-idx1-ubyte.gz
These files are located at the following path:
/cxldata/datasets/project/mnist/
Finally, we will store them in 4 variables:
X_train
, y_train
, X_test
, y_test
Provide the path to the files:
filePath_train_set = '/cxldata/datasets/project/mnist/train-images-idx3-ubyte.gz'
filePath_train_label = '<< your code goes here >>/train-labels-idx1-ubyte.gz'
filePath_test_set = '<< your code goes here >>/t10k-images-idx3-ubyte.gz'
filePath_test_label = '/cxldata/datasets/project/mnist/t10k-labels-idx1-ubyte.gz'
Open the Gzip files:
with gzip.open(filePath_train_label, 'rb') as trainLbpath:
trainLabel = np.frombuffer(trainLbpath.read(), dtype=np.uint8,
offset=8)
with gzip.open(filePath_train_set, 'rb') as trainSetpath:
trainSet = np.frombuffer(trainSetpath.read(), dtype=np.uint8,
offset=16).reshape(len(trainLabel), 784)
with gzip.open(filePath_test_label, 'rb') as testLbpath:
testLabel = np.frombuffer(testLbpath.read(), dtype=np.uint8,
offset=8)
with gzip.open(filePath_test_set, 'rb') as testSetpath:
testSet = np.frombuffer(testSetpath.read(), dtype=np.uint8,
offset=16).reshape(len(testLabel), 784)
Store the data into the 4 variables:
X_train, << your code goes here >>, y_train, y_test = trainSet, testSet, trainLabel, << your code goes here >>
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...