Project- Predicting Noisy Images using KNN Classifier

4 / 10

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, 'rb') as trainLbpath:
         trainLabel = np.frombuffer(, dtype=np.uint8,
    with, 'rb') as trainSetpath:
         trainSet = np.frombuffer(, dtype=np.uint8,
                                   offset=16).reshape(len(trainLabel), 784)
    with, 'rb') as testLbpath:
         testLabel = np.frombuffer(, dtype=np.uint8,
    with, 'rb') as testSetpath:
         testSet = np.frombuffer(, 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 >>
See Answer

No hints are availble for this assesment

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

Loading comments...