# Week 2 : Logistic Regression with a Neural Network mindset

Hi all!

I successfully made it through the exercise; however, there are some points, which are still unclear to me.

1. Just after loading the data, there is this comment:
“We added “_orig” at the end of image datasets (train and test) because we are going to preprocess them (…) the labels train_set_y and test_set_y don’t need any preprocessing”.

Could someone please explain why exactly y labels don’t need preprocessing?

Hi @Anna_Lymarenko , and welcome to the course!

The input data consists of pixel intensities (from 0 to 255) from the three primary color channels: red, green, blue. In Exercise 1, it is explained that the shape of `train_set_X_orig` is a numpy array of shape (m_train, num_px, num_px, 3). That is, there are m training examples (i.e. images), each of height and width `num_px`, for each of the three color channels. An analogous structure holds for the test set images (in `test_set_x_orig`). These are how the data are loaded. The “orig” suffix is attached to indicate that the data will be transformed into a form convenient for building a model (i.e. “preprocessed”)

Exercise 2 has you take care of the “preprocessing” of the downloaded data. Specifically, you"flattened" the downloaded numpy arrays, turning each image into a vector of shape (num_px * num_px * 3, 1) . In the training set, there are m examples so that the shape of `train_set_x_flatten` is (num_px * num_px * 3, m). Finally, the pixel intensity values are “normalized” by dividing each by 255. `test_set_x_orig` is transformed analogously (but there are fewer images).

But `train_set_y` and `test_set_y` do not need preprocessing since these are merely labels identifying whether an image in question if one of a cat (y = 1), or not a cat (y = 0). They are the outputs that your model attempts to predict by assigning a probability to each case. You can think of y=1 as a cat image with probability 1, and y=0 as a cat image with probability 0. These are the target outputs of the model. Thus, no “orig” suffix is needed for the downloaded y-data.

1 Like