This is the exact error I am getting, any suggestion on where to go from here? I have rewatched the relevant Week 3 videos but cannot seem to figure this out.
Debugging is part of the assignment and it’s usually not the most straight forward part, and sometimes I would recommend learners to take a break from it and come back later because this resets our focus so we can look at our code differently in the next time.
There is already some time since you posted the question, and I think you might take the advantage of that and have a look at your code again.
As said, debugging is part of the assignment, and I always suggest learners to assign some numbers to the variable and “run the code in their mind”. The numbers could be simple integer values so they are easy to manipulate in mind or on paper. For example, the function in question has 4 required arguments:
X, y, w, b
Then a good start could be to consider a dataset of 2 samples and 2 features, so that X has two rows and two columns, y has two values, w has two values, and b is a value. For example, we can assign w to be [1, 2], and b to be 1 so that they are all simple numbers.
Before “running the code in mind”, we need a baseline to compare with, right? So we first calculate the cost using the formula provided in the exercise’s description, then we “run the code” in mind or on a paper, and see if we will get to the same answer as the baseline. Through this process, you definitely will find out what you have mistakenly added, missed or done.
Debugging is not favourable, but it’s part of life. Good luck @Muhammad_Ali7
Thank you for your very detailed and thoughtful response. I have gotten somewhat closer to finding the solution. I will do what you mentioned, appreciate your thorough reply.