Week 3 Assignment Exercise 2

In the compute cost function I ran this code below:

[Moderator edit: solution code removed]

And I am getting this error

ValueError: shapes (1,3) and (1,3) not aligned: 3 (dim 1) != 1 (dim 0)

help me resolve this with a little explanation

Hi, @Sandesh_Tyagi. In mathematical terms,The ValueError exception is telling you that two arrays that you are trying to apply vector/matrix multiplication (which the np.dot function will do) are not conformable to that operation.

For a valid expression, the inner product dimensions must of the two matrices must agree. For example, multiplying a (1, 3) by a (3, 1) would work, because 3 = 3. (On that we can all agree.) The result will be a (1, 1) – a scalar. Hint: One of the matrices must be transposed.

Note: It is against the honor code to post your solution code. However, you are encouraged to post an image of your traceback (i.e., the error log). Any code that incidentally shows up in that is fine.

Please explain me this code …
why we did np.random.seed explain the next two lines also