Code error in Optional Lab: Gradient Descent for Logistic Regression (C1_W3_Lab06_Gradient_Descent_Soln)

In the Week 3 Optional Lab: Gradient Descent for Logistic Regression, when plotting the results of gradient descent, the line of code to plot the decision boundary is wrong:

ax.plot([0,x0],[x1,0], c=dlc["dlblue"], lw=1)

Should be

ax.plot([0,x1],[x0,0], c=dlc["dlblue"], lw=1)

Explanation:

Hello Jack @jacktan,

The current code is consistent with your correct understanding about how to derive point A and point B, only that ax.plot accepts two arrays, where the first array is the x coordinates of point A and point B and the second array contains the y coordinates of the two points. We don’t give it the xy-coordinate of point A as the first argument and then the xy-coordinate of point B as the second argument.

For details, we can see the documentation.

Cheers,
Raymond

2 Likes

Oh shoot! You are right, my bad!

Thank you so much!

1 Like

You are welcome, Jack!