Logistic Regression Exercise 2

I’m not understanding why my implementation of flattening the given data set is failing. I have a working answer via transpose, but the following implementation comes naturally to me:

train_set_x_flatten = train_set_x_orig.reshape(num_px * num_px * 3, m_train)
test_set_x_flatten = test_set_x_orig.reshape(num_px * num_px * 3, m_test)

However this fails the provided tests. I am unsure why this fails, and I am also unsure why the transpose method works.

An explanation would help. Thanks.

Hi, @jldeda.

Here is an excellent explanation by @paulinpaloalto.

I’m moving this to DLS Course 1. See you soon in course 2 :slight_smile:

2 Likes