Calculating Cost Function with Dot_Product or Elementwise Multiplication

Dear TAs,

I am wondering how can I tell if I need to use dot product, outer product, or element-wise multiplication from the formula denotation. Any tricks or clues to share?

some formula examples:


image

Any help would be greatly apprciated!

Best,
Olivia

Hello Olivia @zhujunwang,

The recommendation is to follow the writer’s instructions, even if this means you might need to go through a lot of materials. In these courses, it means you would better go back to the lectures to check it since there should be examples to demo that.

You might infer it but it is less recommended. For example, there are requirements to the shapes.

A matrix multiplication AB requires their shapes to be (m, n) and (n, k) (note the same n), and results in (m, k).

An element-wise multiplication requires them to share the same shape.

I don’t recall we have used outer product in these courses. Hopefully in other places where this product is used, it will use the outer product symbol \otimes.

Raymond

PS: I don’t think we have TAs to these courses.

Got it. Thank you so much. It’s very helpful!!