[Week 2][Quiz] Logistic Loss

{moderator edit - quiz question removed}

I always solve this question in wrong way. I don’t know the correct answer.

my wrong answer was based on direct substitution in the last option for L :
L = -1* log(1-0.5)
L = -log(0.5) = 0.301

I just choose the closer to this number but it was incorrect.

I appreciate some explanation.

The problem is that you are using base 10 logs. All the logs here are natural logarithms. According to my calculator:

ln(0.5) = -0.69314…

2 Likes

Many thanks man.

It was not clear for me it was log to base ‘e’.
I didn’t notice it or it was not that abvoius in the course.

I think Prof Ng mentions it when he first discusses the “log loss” cost function, but it goes by pretty fast. The other clue is that if you know calculus you can see that the derivatives of the loss function don’t have any extra constant factors involving ln(10). Given that we need to take derivatives of the loss function, you’d be crazy to use anything other than natural logarithms: it would give fundamentally the same behavior, but generate a huge mess with bogus constants everywhere.

2 Likes

Wow thanks for this, I was breaking my head over why I couldn’t get the right answer to a supposedly really easy equation!

I forgot that in this context it’s ln or log base 2 as a default.

Instead of my calculator, I’ll just use Jupyter for every calculator input I need, just to make sure!

Regards,
Mike