Y = np.logical_and(X[0] == 0, X[1] == 1).astype(int).reshape((1, m))
Here, why are we checking for X[0]==0 and then X[1]==1. And then computing Y based on that. Shoudn’t it be X[0]==0 and then X[1]==0, this way we’ll get a consistent Y.
Y = np.logical_and(X[0] == 0, X[1] == 1).astype(int).reshape((1, m))
Here, why are we checking for X[0]==0 and then X[1]==1. And then computing Y based on that. Shoudn’t it be X[0]==0 and then X[1]==0, this way we’ll get a consistent Y.
We are just creating a dummy dataset here. Any relationship between the two features (X[0] and X[1]) should be fine as long as we can predict Y from them.
What the equation simply means is that Y=1 if and only if X[0]==0 AND X[1]==1; otherwise Y=0. Here’s the truth table:
X0 | X1 | Y |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 0 |
1 | 1 | 0 |