Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The use of "log" vs "ln", chapter 3 - Loss #12

Open
minertom opened this issue Dec 3, 2020 · 2 comments
Open

The use of "log" vs "ln", chapter 3 - Loss #12

minertom opened this issue Dec 3, 2020 · 2 comments

Comments

@minertom
Copy link

minertom commented Dec 3, 2020

I hope that this is not trivial. I was confused by it for a while so I thought that I should bring it up.

Normally, in engineering, when I see Log, without any base, it is assumed to be logarithm to the base 10. In the following from chapter 3, Loss
first_summation = torch.log(positive_pred).sum()

Printing this first summation I noticed the value = tensor(-0.1054)
I was going though the math and realized that this is not equal to log 10 of .9, which is -.045.

Going to the pytorch documentation I saw that "log Returns a new tensor with the natural logarithm of the elements of input."

Of course, in the "From Logits to Probablilties" there is shown the relationship which "kind of" hints towards natural logarithms or log to the base e, but the whole confusion can be avoided by using the symbol "ln" as opposed to "log".

Do you agree?

Thank You
Tom

@dvgodoy
Copy link
Owner

dvgodoy commented Dec 4, 2020

Hi Tom,

I see you're moving quite fast :-)
Thanks for the feedback - you do have a point - I will put this in my to-do list for the final revision.

I guess each field has its own defaults for log... in ML, I've never seen log base 10 or log base 2, it is always natural log.
Since I come from a CS background (and it is always base 2 in information theory), it bugs me a bit to see 0.69 for log(2) instead of 1 bit :-)

Best,
Daniel

@minertom
Copy link
Author

minertom commented Dec 4, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants