#NoPayJan Offer - Access all CloudxLab Courses for free between 1st to 31st Jan

  Enroll Now >>

Predicting Noisy Images - Load the Data

In this step we will load the dataset, and then store it into train and test sets. The dataset consists of 4 files:


These files are located at the following path:


Finally, we will store them in 4 variables:

X_train, y_train, X_test, y_test

  1. 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'
  2. Open the Gzip files:

    with gzip.open(filePath_train_label, 'rb') as trainLbpath:
         trainLabel = np.frombuffer(trainLbpath.read(), dtype=np.uint8,
    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,
    with gzip.open(filePath_test_set, 'rb') as testSetpath:
         testSet = np.frombuffer(testSetpath.read(), dtype=np.uint8,
                                   offset=16).reshape(len(testLabel), 784)
  3. Store the data into the 4 variables:

    X_train, << your code goes here >>, y_train, y_test = trainSet, testSet, trainLabel, << your code goes here >>

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...