DLS Course 1 Week 2 vectorization

Hi, I am just trying to understand the code where you convert from non-vectorized to vectorized logistic regression and I just had a question:

How come in the non-vectorized loop, we calculate cost function J but not in the vectorized component?

Hi @Jae_Yoo.

I am not sure in which assignment / video you had found that, perhaps we could be more focused if you share the source with us?

In any case, I would suggest you to think about it in two ways:

  1. is that just for the purpose of demonstrating vectorization? if so, we could take J as an exercise and try to vectorize it ourselves.

  2. even if we had calculated J vectorized-wise, if you look at the code further down, would it be actually used in anywhere? If it would not be used, then it explained.

Could you vectorize J?

Cheers,
Raymond