Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing inEnroll Now
We split the test data in order to use a part of it for validation purposes. After that, let us have a look at the shape of the train, validation, and test datasets.
np.squeeze() function is used when we want to remove single-dimensional entries from the shape of an array.
For example, let us make a numpy array as follows:
arr = np.arange(1,5) print(arr)
and reshape it in the shape of (1,2,2) as follows:
arr = arr.reshape(1,2,2)
We could use
np.sqeeze to remove the one-dimensional entry to make it of shape (2,2)
arr_squeezed = np.squeeze(arr) print(arr_squeezed) print(arr_squeezed.shape)
The test data contains 50 samples. Let the first 25 samples form the validation data, while the rest 25 samples form the test data.
validation_x = test_set_x_orig[:25] validation_y = << your code comes here >>[:25] print("Validation data shape: ",validation_x.shape) test_set_x =<< your code comes here >>[25:] test_set_y = test_set_y_orig[25:] print("Test data shape: ",<< your code comes here >>)
Write the following code to know about the total number of samples and the shape of the train, validation, and test datasets.
m_train = np.squeeze(train_set_y_orig.shape) m_val = np.squeeze(validation_y.shape) m_test = np.squeeze(test_set_y.shape) num_px = train_set_x_orig.shape print ("Number of training examples: m_train = " + str(m_train)) print ("Number of validation examples: m_test = " + str(m_val)) print ("Number of testing examples: m_test = " + str(m_test)) print ("Height/Width of each image: num_px = " + str(num_px)) print ("Each image is of size: (" + str(num_px) + ", " + str(num_px) + ", 3)")
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