# Week 3 practice lab: logistic regression for plotting non-linear decision boundary

In the final assignment of week 3, in utils.py file.

In Plot decision boundary, the decision boundary is given by as follows,
z[i,j] = sig(np.dot(map_feature(u[i], v[j]), w) + b)

From lectures, i thought w.x+b = 0 is decision boundary. But above definition looks like sigmoid(w.x + b) = 0 to plot the curve. However i tried both with and without sigmoid function. The curve output is different and with sigmoid function the decision boundary is better and capturing more data points inside it. Did i not understand the plotting function correctly or definition of z in above is made different. please explain…

Also in the end, it would also be better if someone can explain why did we calculate z over whole range of (u, v) values and how does plt.contour work… Thank you so much

The comment “Plot z = 0 is incorrect”. It should be “= 0.5”.
The contour() function is drawing the curve at “levels = [0.5]”.

I’ll notify the course authors of the issue.

The reason for using a range of u and v values is to create a 2D grid of the weight value, for which we can compute the cost for this data set. A contour plot is then draw that shows all of the points in the grid that have the value 0.5.