Classroom Item: Week 3 practice lab: logistic regression
In exercise 3.7 at the very bottom, there’s a line that states: “In the function, we plotted the non-linear decision boundary by computing the classifier’s predictions on an evenly spaced grid and then drew a contour plot of where the predictions change from y = 0 to y = 1”
Given that we have the updated parameter values, “w” and “b,” along with the additional polynomial features used for cost computation and gradient descent (x_1^2, x_1*x_2, etc…), I’m curious: why wasn’t the non-linear decision boundary plotted using these polynomial features and updated parameters?
In short, it indeed was plotted with polynomial features and the accordingly trained w and b.
To verify my above statement yourself, we could see that -
the trained w and b were passed into the plot_decision_boundary function
inside the plot_decision_boundary function (that can be checked out via “File” > “Open” > “utils.py”), the w and b were actually used with the polynomial features recreated by the function map_feature which was the very function we had used in the lab to build those polynomial features
if we hadn’t used any polynomial feature but only the original x1 and x2, the plotted boundary would have been a straight line. The non-linearity from the polynomials of x1 and x2 gave us that curved boundary in the space of x1 and x2 which was the very space used in the plot.