Project - Building Cat vs Non-Cat Image Classifier using NumPy and ANN

16 / 32

Cat vs Non-cat Classifier - Feature Scaling

The values of the pixels in RGB images range from 0 to 255.

So, we need to apply Scaling to these features values for our ML algorithms to work fine on them.

After scaling, all the values will be spread in the range of 0 to 1.

Note:

  • min() returns the minimum value of the NumPy array upon which it is called.

  • max() returns the maximum value of the NumPy array upon which it is called.

INSTRUCTIONS
  • Print the minimum and maximum values of the pixels in train data.

    print("Original Min value: ",train_set_x_flatten.reshape(1,-1).min())
    print("Original Max value: ",train_set_x_flatten.reshape(1,-1).max())
    
  • Scale the dataset values by dividing them with 255.

    train_set_x = train_set_x_flatten / 255.
    validation_set_x = << your code comes here >> / 255.
    test_set_x = << your code comes here >> / 255.
    
  • Now, print the minimum and maximum values of the pixels in standardized train data.

    print("Standardized Min value: ",train_set_x.reshape(1,-1).min())
    print("Standardized Max value: ",train_set_x.reshape(1,-1).max())
    
Get Hint See Answer


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

Loading comments...