Splitting the Data

Though the dataset is already split for you between a training set and a test set, it can be useful to split the training set further to have a validation set. We shall do that here.

Let's split the full training set into a validation set and a (smaller) training set. We will also scale the pixel intensities down to the 0-1 range and convert them to floats, by dividing by 255.

INSTRUCTIONS
  • Let us see an image from the dataset using plt.imshow.

    plt.imshow(X_train_full[0], cmap="Greys")
    
  • Let us see the class of the image.

    print ("item0", y_train_full[0])
    
  • Slice the first samples from 55000 of the X_train_full store these samples in X_train.

    X_train = << your code comes here >>[:55000]
    
  • Store the remaining samples from 55000 of the y_train_full to form the y_train.

    y_train = << your code comes here >>[:55000]
    
  • Similarly, slice the remaining samples from the X_train_full and store these samples in X_valid.

    X_valid = << your code comes here >>[55000:]
    
  • Store the remaining values from y_train_full to form the y_valid.

    y_valid = << your code comes here >>[55000:]
    
  • Let us print the shapes of the train data, validation data, and test data.

    print("Train data shape:",X_train.shape)
    print("Validation data shape:",<< your code comes here >>)
    print("Test data shape:",<< your code comes 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...