Hello I am really confused about exercise 8.
{moderator edit: code removed
I am getting an error because I am attempting to dot vectors of wrong dimension. Here is my earlier code from propagate function which passed the tests:
{moderator edit: code removed
So A is dimension (4, 1), and Y is dimension (7, 1). I can’t flip dimensions of A so this dot product does not work.
TMosh
October 4, 2023, 7:26pm
2
Did you try transposing ‘A’ in the cost calculation?
The problem is that screws up the exercise for the propagate function-- the dimensions don’t match
TMosh
October 4, 2023, 7:29pm
5
Should not need a transpose here.
TMosh
October 4, 2023, 7:30pm
6
I think you transposed the wrong variable.
Bc shape is a matric 2x2, w is a vector
Because its within propagate function, and if i try to alter in there I ruin the other exercise for propagate function
TMosh
October 4, 2023, 7:31pm
10
Don’t rely on that in all cases. Your code will be tested with several different sizes of matrix - not all of them are square.
Your implementation of A is wrong in the first place. Here’s the math formula for the code you wrote:
A = sigmoid(X^T \cdot w + b)
Please have a look at the formulas in the instructions. That’s not what they say, right?
TMosh
October 4, 2023, 7:32pm
12
Don’t modify the variable, just transpose it where you’re using it in np.dot().
TMosh
October 4, 2023, 7:34pm
13
Also, I’ll edit the thread to remove the code from the OP, because posting your code on the forum isn’t allowed by the Code of Conduct.
Generally, a mentor will give you specific instructions if we need to see your code.
Easy enough to clean it up afterward.