Cost function for logisitic regression : Has Andrew made a mistake here?

Hello,

I have listened and watched the video lesson entitled “Cost function for logistic regression” and at 9 mins 28 secs Andrew seems to have made a mistake here as he says “In fact, if f of x approaches 0, the loss here actually goes really large and in fact approaches infinity.”.

However, in this part of the lesson, Andrew is talking about the loss function:

-log(1 - f_{\vec w, b}(\vec x^{(i)}))

and what happens to its value when f(x) approaches 0. The loss function in fact approaches 0 too as f(x) approaches 0, not \infty.

The equations below also seem to contradict what he is saying as they say:

As -log(1 - f_{\vec w, b}(\vec x^{(i)})) \to 1 then loss \to \infty

Can anyone confirm that a mistake has been made here?

Thanks.

Hi @ai_is_cool .

The are two scenarios when dealing with the loss function:

  1. When the target label Y=1
  2. when the target label Y=0
    In the case when Y=0, and f(x) → 1, then the loss is → ∞. That is to say that when the model prediction is high, near 1, but the target label is actually 0, then the loss has to be very high, to reflect the inaccuracy.
    Here is a screenshot of the lecture.
1 Like

Hi there,

Thank you for taking the time to reply.

But do you think Andrew has made a mistake in what he said in the video at 9 min 28 secs?

Hi @ai_is_cool ,

You are right, I will file a report. Many thanks.

1 Like

So I see from an email I received that you posted a comment on the forum beginning…

“ I revisited the segment of video that you are referring to, and I didn’t find…”

In which you say Andrew didn’t make a mistake so am I correct in thinking that you now do hear him make a mistake?

Thank you.

Hi @ai_is_cool

Yes, I withdrew my earlier reply after listening to his summary again. The content of the slide is correct, but he said it wrong by mistake, I guess it is a slip of the tongue. This matter is now lodged with a staff member who is taking a further look into it.

Thank you for bringing this to our attention.

No problem.

How long ago did Andrew create this video lesson do you know?

Hi @ai_is_cool ,

The MLS series of courses was published just over 2 years ago. You have a keen eye/ear for details and nothing escapes your attention. We appreciate very much your effort to help us in getting things right.

2 Likes

No problem!

I love learning about ML and the mathematics behind it and I want to make sure I understand everything and for other students to understand too.

2 Likes