The error here is in the calculation of sigmoid, the np.dot(w.T, X) their shapes are not as suppesed to be. For eg. If w.T is MxN then X needs be (any size) x M, the column dimension of the second matrix needs be same as the row of the first matrix in the dot product.

@TMosh can you let me know what to do if I get stuck up with some error in my code at some point?. Is there a way to contact a mentor directly without posting the error/problem, kindly let me know. By far the mentors have been doing a great job troubleshooting.