The reason it fails is that you have not used the correct formula. “*” means “elementwise” multiply, but you need dot product style multiply there. My guess is that you just need an explanation of the notation that Prof Ng uses for multiplication. Here’s a thread which goes through all that in detail. Please have a look and let us know if any further questions after reading that.
1 Like