Neural Networks and Deep Learning Course Week 2 Logistic Regression

how there are 3 labels for two images here?

w = np.array([[1.], [2]])
b = 1.5
X = np.array([[1., -2., -1.], [3., 0.5, -3.2]])
Y = np.array([[1, 1, 0]])
grads, cost = propagate(w, b, X, Y)

assert type(grads[“dw”]) == np.ndarray
assert grads[“dw”].shape == (2, 1)
assert type(grads[“db”]) == np.float64

print ("dw = " + str(grads[“dw”]))
print ("db = " + str(grads[“db”]))
print ("cost = " + str(cost))

propagate_test(propagate)

Dear @Marwan_Hatem,

Can you please elaborate your problem in detail.

1 Like

It’s a quirk in how that X matrix is defined. It has three examples of two features each. They’re oriented the opposite from what you would expect.

2 Likes

Of course , there are two images only represented as two vectors , but there are 3 Y labels that means there are three images am I right?

1 Like

That means they are three. Images not two? Wow

1 Like

There are no images in this example. Just three examples, each with two features.

Maybe look at it this way.

  • The first vector of three values is all of the 1st features.
  • The second vector of three values is all of the 2nd features.

It’s formatted in a confusing way. But it’s still three examples.

1 Like

Thank you for making it clearer now.

1 Like