Course 5 Weekk 2 Assignment 2 Ex 2 - Math notation?

Hi all,

Fairly simple notation question: the equations listed for Ex. 2 are as follows:

z^{(i)} = Wavg^{(i)} + b

a^{(i)} = softmax(z^{(i)})

\mathcal{L}^{(i)} = - \sum_{k = 0}^{n_y - 1} Y_{oh,k}^{(i)} * log(a^{(i)}_k)

*Note: these are not solutions, they are equations provided in the prompt.

I managed to complete the exercise, finding that the z and loss functions both use the dot product rather than element-wise multiplication. The notation for them in the prompt is different, however, with the z value’s calculation not including a ’ * ’ and the Loss calculation including a ’ * '.

Is there a convention for when the dot product / element-wise multiplication / cross product / other multiplication should be used? It’s 100% ok if there isn’t a convention, I’m just trying to understand if there is a convention.

Thank you all!

Here’s a thread with some discussion of that question.

Note that it looks like the LaTeX plugin somehow failed for you. Here’s how those equations should have rendered:

z^{(i)} = Wavg^{(i)} + b

a^{(i)} = softmax(z^{(i)})

\mathcal{L}^{(i)} = - \displaystyle \sum_{k = 0}^{n_y - 1} Y_{oh,k}^{(i)} * log(a^{(i)}_k)

With the information in that thread I referenced above, you should be able to decode which operations are dot products and which are elementwise.

1 Like