C1_W3_Lab06_Gradient_Descent_Soln (Regarding plotting the results of gradient descent)


Hi, I am confused with the code block, plotting the decision boundary, at the end of the above code block.

From my understanding, it should be
ax.plot([0, x1], [x0, 0], …), not ax.plot([0,x0],[x1,0], …),
because,

If someone could explain where I get confused about this code,
I would really appreciate it.
Thank you in advance.

1 Like

Welcome to the community.

That’s a syntax for matplotlib.
Parameters for “plot” is 1D array for X and 1D array for Y.
So, it can be interpreted as X = [0, x_0], Y = [x_1,0]. So, just want to put a line from (0,x_1) to ((x_0,0) in (x,y) form.

Thank you very much for clarifying this for me. :slight_smile: