< code removed >
what should i do ? should i transpose X or W ?
hi @ludi , welcome to the community! Just make sure not to post your full solutions as the policy is that we do not share solutions. Your code snipit (which I removed) is different from the code on which the error message is generated. To give you a hint, look at the formulas that are shown at the beginning of exercise 4 just above the instructions. You should implement just that, so no transpose. Hope this helps.
The other key thing to realize is the notational convention that Prof Ng uses for matrix multiplication. There are two fundamentally different types of multiplication: dot product and “elementwise”. When Prof Ng means elementwise multiply, he always uses * as the operator. If he means dot product style matrix multiply, he just writes the operands adjacent with no explicit operator. If you check the linear activation formulas, you will see that the operation is dot product. It looks like you are doing elementwise multiply. That will not end well.
Hi, thanks for your answer, i just realize there should use dot product but not elementwise.
Thank your answer, I just realize shouldn’t transpose the matrix.