Project - Training from Scratch vs Transfer Learning

3 / 8

Preparing the Dataset

  • Let us load the dataset and trim it to form a shorter dataset, as training a bigger dataset would take a lot of time.
INSTRUCTIONS
  • Load the Fashion MNIST data from keras as follows. The dataset is already preprocessed and already split into train and test sets. So we shall receive them accordingly while loading the data.

    (X_train_full, y_train_full), (X_test, y_test) = keras.datasets.fashion_mnist.load_data()
    
  • Let us trim the train data by considering the first 30,000 data samples to be part of our train data. So slice the first 30,000 samples from X_train_full and y_train_full.

    X_train_full = << your code comes here >>[:30000]
    y_train_full = << your code comes here >>[:30000]
    
  • Let us also trim the test data by considering the first 5000 data samples to be part of our test data. So slice the first 5000 samples from X_test and y_test.

    X_test = << your code comes here >>[:5000]
    y_test = << your code comes here >>[:5000]
    
  • Scale the train and test datasets by dividing with 255. so that the values will be in the range of 0-1.

    X_train_full = X_train_full / 255.0
    X_test = X_test / 255.0
    
  • Let us divide the X_train_full such that the first 5000 samples form X_valid and the remaining to be in X_train.

    X_valid, X_train = << your code comes here >>[:5000], << your code comes here >>[5000:]
    
  • Similarly, let us divide the y_train_full such that the first 5000 samples form y_valid and the remaining to be in y_train.

    y_valid, y_train = << your code comes here >>[:5000], << your code comes here >>[5000:]
    
Get Hint See Answer


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

Loading comments...